blob: 950efdcd523021b5d5247f4fbc2366f3f29347a5 [file] [log] [blame]
Skyler Grey0409e462022-08-19 23:40:48 +01001{
2 description = "Minion's NixOS configuration (since 2022-08-19)";
Skyler Greybcb2cb72022-08-21 07:24:35 +01003 inputs = {
4 nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
Skyler Grey2f9904e2022-09-05 03:18:02 +01005 nixpkgs-minion.url = "github:Minion3665/nixpkgs";
Skyler Greybcb2cb72022-08-21 07:24:35 +01006 flake-utils.url = "github:numtide/flake-utils";
Skyler Grey6be25172022-10-30 22:58:55 +00007 flake-utils-plus.url = "github:gytis-ivaskevicius/flake-utils-plus";
Skyler Grey2a7ca382022-09-01 23:15:31 +01008 vscode-extensions.url = "github:AmeerTaweel/nix-vscode-marketplace";
Skyler Greybcb2cb72022-08-21 07:24:35 +01009 registry = {
10 url = "github:nixos/flake-registry";
11 flake = false;
12 };
13 home-manager.url = "github:nix-community/home-manager/release-22.05";
Skyler Grey2a7ca382022-09-01 23:15:31 +010014 home-manager-unstable.url = "github:nix-community/home-manager";
Skyler Greybcb2cb72022-08-21 07:24:35 +010015 sops-nix.url = "github:Mic92/sops-nix";
16 impermanence.url = "github:nix-community/impermanence";
Skyler Grey2a7ca382022-09-01 23:15:31 +010017 gtimelog = {
18 url = "git+https://gitlab.collabora.com/collabora/gtimelog.git";
19 flake = false;
20 };
Skyler Grey934f1422022-09-04 11:50:04 +010021 fzf-tab = {
22 url = "github:Aloxaf/fzf-tab";
23 flake = false;
24 };
Skyler Greya589ea12022-10-31 00:03:57 +000025 omnisharp-language-server = {
26 url = "github:coc-extensions/coc-omnisharp";
27 flake = false;
28 };
29 kmonad = {
30 url = "github:kmonad/kmonad?dir=nix";
31 inputs.nixpkgs.follows = "nixpkgs";
32 };
Skyler Grey61635852022-10-31 00:27:04 +000033 fenix.url = "github:nix-community/fenix";
34 prismlauncher.url = "github:PrismLauncher/PrismLauncher";
Skyler Greybcb2cb72022-08-21 07:24:35 +010035
Skyler Grey61635852022-10-31 00:27:04 +000036 fenix.inputs.nixpkgs.follows = "nixpkgs";
Skyler Grey6be25172022-10-30 22:58:55 +000037 flake-utils-plus.inputs.flake-utils.follows = "flake-utils";
Skyler Greybcb2cb72022-08-21 07:24:35 +010038 home-manager.inputs.nixpkgs.follows = "nixpkgs";
Skyler Grey2a7ca382022-09-01 23:15:31 +010039 home-manager-unstable.inputs.nixpkgs.follows = "nixpkgs";
Skyler Greybcb2cb72022-08-21 07:24:35 +010040 sops-nix.inputs.nixpkgs.follows = "nixpkgs";
Skyler Grey7dfe5c62022-08-20 21:41:30 +010041 };
Skyler Grey0409e462022-08-19 23:40:48 +010042
Skyler Grey252927a2022-10-18 22:18:15 +010043 outputs = inputs:
44 let
45 inherit (inputs) self nixpkgs flake-utils;
46 in
47 flake-utils.lib.eachDefaultSystem (system:
48 let
49 pkgs = import nixpkgs {
Skyler Grey7dfe5c62022-08-20 21:41:30 +010050 inherit system;
Skyler Grey61635852022-10-31 00:27:04 +000051 overlays = import ./overlays nixpkgs.lib (inputs // { inherit inputs
52 username; });
Skyler Grey7dfe5c62022-08-20 21:41:30 +010053 };
Skyler Grey252927a2022-10-18 22:18:15 +010054
55 utils = import ./utils nixpkgs.lib;
56
57 username = "minion";
58
59 isAttrType = type:
60 if builtins.elem type.name [ "submodule" ]
61 then true
62 else if type ? nestedTypes.elemType
63 then isAttrType type.nestedTypes.elemType
64 else false;
65
66 normalizeOptions = options:
67 if
68 nixpkgs.lib.traceSeqN 2
69 {
70 inherit options;
71 type = builtins.typeOf options;
72 }
73 builtins.typeOf
74 options
75 == "set"
76 then
77 nixpkgs.lib.mapAttrs
78 (
79 name: value:
80 if
81 nixpkgs.lib.traceSeqN 3
82 {
83 inherit name value;
84 hasGetSubOpts = value ? getSubOptions;
85 hasType = value ? type;
86 isAttrType = value ? type && isAttrType value.type;
87 typeName = value.type.name or "unnamed";
88 type = builtins.typeOf value;
89 }
90 (builtins.typeOf value)
91 == "set"
92 then
93 nixpkgs.lib.traceVal
94 (normalizeOptions (
95 if value ? type && isAttrType value.type
96 then nixpkgs.lib.traceVal (value.type.getSubOptions [ ])
97 else nixpkgs.lib.traceVal value
98 ))
99 else value
100 )
101 options
102 else options;
103 in
104 {
105 packages.nixosConfigurations = {
106 default = nixpkgs.lib.nixosSystem {
107 inherit system;
108
109 modules = [
110 (nixpkgs.lib.pipe ./modules [
111 utils.nixFilesIn
112 (utils.interpretNonstandardModule (args:
113 args
114 // {
115 home = args.config.home-manager.users.${username};
116 home-options =
117 nixpkgs.lib.traceVal (normalizeOptions
118 (args.options.home-manager.users.type.getSubOptions [ ]));
119 inherit system utils;
120 }))
121 ])
122 {
123 minion = import ./config.nix;
124 }
125 ];
126
127 specialArgs = inputs // { inherit inputs username; };
128 };
129 };
130 devShell = pkgs.mkShell {
131 nativeBuildInputs = with pkgs; [ nodePackages.prettier nixpkgs-fmt ];
132 buildInputs = [ ];
133 };
134 formatter = pkgs.nixpkgs-fmt;
135 });
Skyler Grey0409e462022-08-19 23:40:48 +0100136}