about summary refs log tree commit diff stats
path: root/flake/default.nix
blob: 1170efa3b432da0e0b8d5317b40b6865184fee69 (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
# nixos-config - My current NixOS configuration
#
# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
# SPDX-License-Identifier: GPL-3.0-or-later
#
# This file is part of my nixos-config.
#
# You should have received a copy of the License along with this program.
# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
{
  self,
  system,
  openPRsNixpkgs,
  packageSets,
  libraries,
  modules,
  externalDependencies,
  externalBinaries,
}: let
  # Unpack common stuff.
  nixLib = libraries.extra;
  pkgs = packageSets.unstable;

  treefmtEval = import ./treefmt.nix {
    inherit (externalDependencies) treefmt-nix;
    inherit pkgs;
  };

  nixosConfigurations = import ../hosts {
    inherit
      self
      system
      openPRsNixpkgs
      packageSets
      libraries
      modules
      externalDependencies
      externalBinaries
      ;
  };

  tests = import ../tests {
    inherit pkgs nixLib openPRsNixpkgs system;
    myPkgs = packageSets.soispha;
    inherit (pkgs) lib;
    extraModules = {
      nixvim = {
        homeManagerModule = modules.nixVim.homeManagerModules.nixvim;
      };
      agenix = modules.agenix.nixosModules.default;
      disko = modules.disko.nixosModules.default;
      serverphone = modules.serverphone.nixosModules.default;
      inherit (modules.home-manager.nixosModules) home-manager;
      inherit (modules.impermanence.nixosModules) impermanence;
      inherit (modules.lanzaboote.nixosModules) lanzaboote;
    };
  };
in {
  inherit nixosConfigurations;
  checks."${system}" =
    nixLib.warnMerge {
      inherit
        (self.packages."${system}")
        nvim
        ;
      formatting = treefmtEval.config.build.check self;
    }
    tests "flake checks";

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

  packages."${system}" = import ./packages {
    inherit
      pkgs
      self
      ;
    myPkgs = packageSets.soispha;
  };

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

  baseLib."${system}" = libraries.base;

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

        # other
        pkgs.cocogitto
        pkgs.git-bug
        pkgs.reuse

        # secrets
        pkgs.ragenix
        pkgs.rage

        # shell
        pkgs.shfmt

        # rust
        pkgs.rustfmt
        pkgs.cargo

        # nix
        pkgs.alejandra
        pkgs.deadnix

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