summaryrefslogtreecommitdiff
path: root/flake.nix
blob: c6b85d86ccf00d69714af183b2f90f7bd71b4743 (plain)
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
{
  description = "nixconfig";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-26.05";

    flake-parts.url = "github:hercules-ci/flake-parts";

    nixos-hardware.url = "github:NixOS/nixos-hardware/master";

    hjem = {
      url = "github:feel-co/hjem";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    impermanence = {
      url = "github:nix-community/impermanence";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    sls-steam = {
      url = "github:AceSLS/SLSsteam";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    openmw-nix = {
      url = "git+https://codeberg.org/adikro/openmw-nix.git";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    sops-nix = {
      url = "github:Mic92/sops-nix";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    disko = {
      url = "github:nix-community/disko/latest";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    omnisearch = {
      url = "git+https://git.bwaaa.monster/omnisearch?shallow=0";
      # inputs.nixpkgs.follows = "nixpkgs";
    };

    otter-launcher = {
      url = "github:kuokuo123/otter-launcher";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs =
    inputs@{ flake-parts, ... }:
    flake-parts.lib.mkFlake { inherit inputs; } {

      imports = [
        (inputs.flake-parts.lib.importTree ./modules)
      ];

      perSystem = { pkgs, ... }: {
        formatter = pkgs.nixfmt-rfc-style;
      };

      flake = {
        nixosModules.default = {
          imports = [ inputs.hjem.nixosModules.default ];
        };

        nixosConfigurations =
          let
            mkHost =
              {
                hostname,
                user ? "adam",
                pkgsInput ? inputs.nixpkgs,
                path ? ./hosts/${hostname}/configuration.nix,
              }:
              pkgsInput.lib.nixosSystem {
                specialArgs = {
                  inherit inputs;
                  username = user;
                  pkgs-unstable = import inputs.nixpkgs {
                    system = "x86_64-linux";
                    config.allowUnfree = true;
                  };
                  pkgs-stable = import inputs.nixpkgs-stable {
                    system = "x86_64-linux";
                    config.allowUnfree = true;
                  };
                };
                modules = [
                  inputs.hjem.nixosModules.default
                  inputs.disko.nixosModules.disko
                  inputs.impermanence.nixosModules.impermanence
                  inputs.sops-nix.nixosModules.sops

                  path
                  { networking.hostName = hostname; }
                ];
              };
          in
          {
            szpont = mkHost { hostname = "szpont"; };
            thinkpad = mkHost { hostname = "thinkpad"; };
            pendrive = mkHost {
              hostname = "pendrive";
              user = "user";
              pkgsInput = inputs.nixpkgs-stable;
            };
          };
      };
    };
}