-
Notifications
You must be signed in to change notification settings - Fork 2
/
flake.nix
83 lines (81 loc) · 2.66 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
{
description = "My nixos config";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
unstable-pkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
nur = {
url = "github:nix-community/NUR/master";
};
sops = {
url = "github:Mic92/sops-nix/master";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager/release-24.05";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, sops, nur, home-manager, nixos-hardware, ... }@inputs:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
inputNames = builtins.filter (name: name != "self") (builtins.attrNames inputs);
inputUpdates = builtins.foldl' (acc: input: acc ++ [ "--update-input" (builtins.toString "${input}") ]) [ ] inputNames;
xadetPackages = import ./packages {inherit pkgs;};
nixosMachine = configFile: nixpkgs.lib.nixosSystem rec {
inherit system;
specialArgs = {
inherit inputs;
unstable = import inputs.unstable-pkgs { inherit system; config.allowUnfree = true; };
};
modules = [
{ nixpkgs.overlays = [ (final: prev: xadetPackages) ]; }
home-manager.nixosModules.home-manager
sops.nixosModules.sops
nur.nixosModules.nur
"${./.}/machines/${configFile}.nix"
{
system = {
autoUpgrade = {
enable = true;
dates = "13:00";
persistent = true;
flake = "/etc/nixos/flake.nix#${configFile}";
flags = [ "--refresh" ] ++ inputUpdates;
};
};
}
{
options = {
usedFlake = pkgs.lib.mkOption {
type = pkgs.lib.types.str;
default = "${configFile}";
};
};
}
];
};
in
{
packages."${system}" = xadetPackages;
devShells."${system}".default = pkgs.mkShell {
packages = [
pkgs.sops
pkgs.age
];
SOPS_AGE_KEY_FILE = "/home/xadet/nixos-configuration/keys/ageKey.txt";
};
installIso = (nixpkgs.lib.nixosSystem rec {
inherit system;
modules = [
"${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"
./install/iso.nix
];
}).config.system.build.isoImage;
nixosConfigurations = builtins.foldl' (set: name: set // { "${name}" = nixosMachine "${name}"; }) { } [
"desktop-home"
"eove"
];
};
}