nix/flake.nix

134 lines
3.2 KiB
Nix

{
description = "My systems installation";
inputs = {
nixpkgs.url = "nixpkgs/nixos-unstable";
nur.url = "github:nix-community/NUR";
nixgl = {
url = "github:nix-community/nixGL";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-private = {
url = "git+ssh://git@git.epha.se:24422/ephase/nix-private.git?shallow=1&ref=main";
};
};
outputs = {
self,
nixpkgs,
home-manager,
nur,
nixgl,
sops-nix,
...
} @ inputs: let
stateVersion = "23.11";
allSystems = [
"x86_64-linux" # 64bit AMD/Intel x86
"aarch64-linux" # 64bit ARM Linux
];
forAllSystems = fn:
nixpkgs.lib.genAttrs allSystems
(system: fn {pkgs = import nixpkgs {inherit system;};});
createNixosSystem = {
system,
hostname,
username ? "ephase",
}:
nixpkgs.lib.nixosSystem {
system = system;
specialArgs = {
inherit stateVersion inputs;
hostname = hostname;
username = username;
};
modules = [
./nixos/default.nix
];
};
createHomeConfiguration = {
system ? "x86_64-linux",
hostname,
username ? "ephase",
}:
home-manager.lib.homeManagerConfiguration {
pkgs = import nixpkgs {
system = system;
overlays = [nixgl.overlay];
};
extraSpecialArgs = {
inherit stateVersion inputs nixgl;
hostname = hostname;
username = username;
};
modules = [
{nixpkgs.overlays = [nixgl.overlay];}
./home-manager/default.nix
];
};
in {
devShells = forAllSystems ({pkgs}: {
default = pkgs.mkShell {
name = "nixfiles";
buildInputs = [
pkgs.sops
pkgs.age
pkgs.shellcheck
pkgs.shfmt
pkgs.lefthook
pkgs.go-task
pkgs.convco
pkgs.typos
pkgs.home-manager
];
};
});
nixosConfigurations = {
morty = createNixosSystem {
system = "x86_64-linux";
hostname = "morty";
};
mrmeeseeks = createNixosSystem {
system = "x86_64-linux";
hostname = "mrmeeseeks";
};
luci = createNixosSystem {
system = "x86_64-linux";
hostname = "luci";
};
};
homeConfigurations = {
"rick" = createHomeConfiguration {
system = "aarch64-linux";
hostname = "rick";
};
"luci" = createHomeConfiguration {
system = "x86_64-linux";
hostname = "luci";
};
"morty" = createHomeConfiguration {
system = "x86_64-linux";
hostname = "morty";
};
"mrmeeseeks" = createHomeConfiguration {
system = "x86_64-linux";
hostname = "mrmeeseeks";
};
"work" = createHomeConfiguration {
system = "x86_64-linux";
hostname = "work";
username = "yorick-barbanneau";
};
};
};
}