blob: e5aa8d17bcdfbfb15960edc71fbb17114dcb3374 [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 Greyd01ca9c2022-11-02 08:08:32 +00006 nixpkgs-staging-next.url = "github:NixOS/nixpkgs/staging-next";
Skyler Greybcb2cb72022-08-21 07:24:35 +01007 flake-utils.url = "github:numtide/flake-utils";
Skyler Grey6be25172022-10-30 22:58:55 +00008 flake-utils-plus.url = "github:gytis-ivaskevicius/flake-utils-plus";
Skyler Grey2a7ca382022-09-01 23:15:31 +01009 vscode-extensions.url = "github:AmeerTaweel/nix-vscode-marketplace";
Skyler Greybcb2cb72022-08-21 07:24:35 +010010 registry = {
11 url = "github:nixos/flake-registry";
12 flake = false;
13 };
14 home-manager.url = "github:nix-community/home-manager/release-22.05";
Skyler Grey2a7ca382022-09-01 23:15:31 +010015 home-manager-unstable.url = "github:nix-community/home-manager";
Skyler Greybcb2cb72022-08-21 07:24:35 +010016 sops-nix.url = "github:Mic92/sops-nix";
17 impermanence.url = "github:nix-community/impermanence";
Skyler Grey2a7ca382022-09-01 23:15:31 +010018 gtimelog = {
19 url = "git+https://gitlab.collabora.com/collabora/gtimelog.git";
20 flake = false;
21 };
Skyler Grey934f1422022-09-04 11:50:04 +010022 fzf-tab = {
23 url = "github:Aloxaf/fzf-tab";
24 flake = false;
25 };
Skyler Greya589ea12022-10-31 00:03:57 +000026 omnisharp-language-server = {
27 url = "github:coc-extensions/coc-omnisharp";
28 flake = false;
29 };
30 kmonad = {
31 url = "github:kmonad/kmonad?dir=nix";
32 inputs.nixpkgs.follows = "nixpkgs";
33 };
Skyler Grey61635852022-10-31 00:27:04 +000034 fenix.url = "github:nix-community/fenix";
Skyler Greyd01ca9c2022-11-02 08:08:32 +000035 prismlauncher.url = "github:Scrumplex/nixpkgs/update-prismlauncher-5.1";
Skyler Greybcb2cb72022-08-21 07:24:35 +010036
Skyler Grey61635852022-10-31 00:27:04 +000037 fenix.inputs.nixpkgs.follows = "nixpkgs";
Skyler Grey6be25172022-10-30 22:58:55 +000038 flake-utils-plus.inputs.flake-utils.follows = "flake-utils";
Skyler Greybcb2cb72022-08-21 07:24:35 +010039 home-manager.inputs.nixpkgs.follows = "nixpkgs";
Skyler Grey2a7ca382022-09-01 23:15:31 +010040 home-manager-unstable.inputs.nixpkgs.follows = "nixpkgs";
Skyler Greybcb2cb72022-08-21 07:24:35 +010041 sops-nix.inputs.nixpkgs.follows = "nixpkgs";
Skyler Grey7dfe5c62022-08-20 21:41:30 +010042 };
Skyler Grey0409e462022-08-19 23:40:48 +010043
Skyler Grey252927a2022-10-18 22:18:15 +010044 outputs = inputs:
45 let
46 inherit (inputs) self nixpkgs flake-utils;
47 in
48 flake-utils.lib.eachDefaultSystem (system:
49 let
50 pkgs = import nixpkgs {
Skyler Grey7dfe5c62022-08-20 21:41:30 +010051 inherit system;
Skyler Grey61635852022-10-31 00:27:04 +000052 overlays = import ./overlays nixpkgs.lib (inputs // { inherit inputs
53 username; });
Skyler Grey7dfe5c62022-08-20 21:41:30 +010054 };
Skyler Grey252927a2022-10-18 22:18:15 +010055
56 utils = import ./utils nixpkgs.lib;
57
58 username = "minion";
59
60 isAttrType = type:
61 if builtins.elem type.name [ "submodule" ]
62 then true
63 else if type ? nestedTypes.elemType
64 then isAttrType type.nestedTypes.elemType
65 else false;
66
67 normalizeOptions = options:
68 if
69 nixpkgs.lib.traceSeqN 2
70 {
71 inherit options;
72 type = builtins.typeOf options;
73 }
74 builtins.typeOf
75 options
76 == "set"
77 then
78 nixpkgs.lib.mapAttrs
79 (
80 name: value:
81 if
82 nixpkgs.lib.traceSeqN 3
83 {
84 inherit name value;
85 hasGetSubOpts = value ? getSubOptions;
86 hasType = value ? type;
87 isAttrType = value ? type && isAttrType value.type;
88 typeName = value.type.name or "unnamed";
89 type = builtins.typeOf value;
90 }
91 (builtins.typeOf value)
92 == "set"
93 then
94 nixpkgs.lib.traceVal
95 (normalizeOptions (
96 if value ? type && isAttrType value.type
97 then nixpkgs.lib.traceVal (value.type.getSubOptions [ ])
98 else nixpkgs.lib.traceVal value
99 ))
100 else value
101 )
102 options
103 else options;
104 in
105 {
106 packages.nixosConfigurations = {
107 default = nixpkgs.lib.nixosSystem {
108 inherit system;
109
110 modules = [
111 (nixpkgs.lib.pipe ./modules [
112 utils.nixFilesIn
113 (utils.interpretNonstandardModule (args:
114 args
115 // {
116 home = args.config.home-manager.users.${username};
117 home-options =
118 nixpkgs.lib.traceVal (normalizeOptions
119 (args.options.home-manager.users.type.getSubOptions [ ]));
120 inherit system utils;
121 }))
122 ])
123 {
124 minion = import ./config.nix;
125 }
126 ];
127
128 specialArgs = inputs // { inherit inputs username; };
129 };
130 };
131 devShell = pkgs.mkShell {
132 nativeBuildInputs = with pkgs; [ nodePackages.prettier nixpkgs-fmt ];
133 buildInputs = [ ];
134 };
135 formatter = pkgs.nixpkgs-fmt;
136 });
Skyler Grey0409e462022-08-19 23:40:48 +0100137}