nix/flake.nix

93 lines
2.8 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";
};
};
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;
hostname = hostname;
username = username;
};
modules = [
./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 = {
"ephase@rick" = createHomeConfiguration { system = "aarch64-linux"; hostname = "rick";};
"ephase@luci" = createHomeConfiguration { system = "x86_64-linux"; hostname = "luci";};
"ephase@morty" = createHomeConfiguration { system = "x86_64-linux"; hostname = "morty";};
"ephase@mrmeeseeks" = createHomeConfiguration { system = "x86_64-linux"; hostname = "mrmeeseeks";};
"yorick-barbanneau@work" = createHomeConfiguration {
system = "x86_64-linux";
hostname = "work";
username = "yorick-barbanneau";
};
};
};
}