about summary refs log tree commit diff stats
path: root/flake/default.nix
blob: ded656e754167035cbe8844f40066700163777a9 (plain) (blame)
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
{
  # core
  self,
  pkgs,
  pkgsStable,
  nixLib,
  myPkgs,
  system,
  sysLib,
  nixpkgs_as_input,
  nixpkgs_open_prs,
  # modules
  home-manager,
  nixVim,
  nixos-generators,
  impermanence,
  agenix,
  ragenix,
  serverphone,
  disko,
  lanzaboote,
  nix-index-database,
  # external dependencies
  user_js,
  treefmt-nix,
  templates,
  # my binaries
  shell_library,
  river_init_lesser,
}: let
  treefmtEval = import ./treefmt.nix {inherit treefmt-nix pkgs;};

  nixosConfigurations = import ./nixosConfigurations {
    inherit
      self
      pkgsStable
      myPkgs
      system
      nixpkgs_as_input
      nixpkgs_open_prs
      # my things
      shell_library
      sysLib
      templates
      # modules
      home-manager
      nixVim
      nixos-generators
      impermanence
      agenix
      ragenix
      serverphone
      disko
      lanzaboote
      nix-index-database
      # bins
      river_init_lesser
      # external
      user_js
      ;
  };

  tests = import ../tests {
    inherit pkgs nixpkgs_as_input myPkgs;
    inherit (pkgs) lib;
    extraModules = {
      termfilechooser = "${nixpkgs_open_prs.nixpkgs-tfc}/nixos/modules/config/xdg/portals/termfilechooser.nix";

      nixvim = {
        homeManagerModule = nixVim.homeManagerModules.nixvim;
      };
      agenix = agenix.nixosModules.default;
      disko = disko.nixosModules.default;
      serverphone = serverphone.nixosModules.default;
      inherit (home-manager.nixosModules) home-manager;
      inherit (impermanence.nixosModules) impermanence;
      inherit (lanzaboote.nixosModules) lanzaboote;
    };
  };
in {
  inherit nixosConfigurations;
  checks."${system}" =
    nixLib.maybeMerge {
      inherit
        (self.packages."${system}")
        nvim
        ;
      formatting = treefmtEval.config.build.check self;
    }
    tests "flake checks";

  # legacyPackages."${system}" = pkgs;

  packages."${system}" = import ./packages {
    inherit
      nixos-generators
      pkgs
      pkgsStable
      myPkgs
      sysLib
      system
      nixVim
      self
      shell_library
      ;
    inherit (pkgs) lib;
  };

  formatter."${system}" = treefmtEval.config.build.wrapper;

  apps."${system}" = import ./apps {inherit self system;};

  devShells."${system}" = {
    default = pkgs.mkShell {
      packages = [
        # secure boot
        pkgs.sbctl

        # other
        pkgs.cocogitto
        pkgs.git-bug

        # secrets
        ragenix.packages."${system}".default
        pkgs.rage

        # shell
        pkgs.shfmt

        # rust
        pkgs.rustfmt
        pkgs.cargo

        # nix
        pkgs.alejandra

        # update
        myPkgs.generate_moz_extension # needed for the firefox extension update script
        myPkgs.lf-make-map # needed to generate the lf cd mappings
        myPkgs.update-vim-plugins
      ];
    };
  };
}