summaryrefslogtreecommitdiff
path: root/flake.nix
blob: b456354b46beb86b7e5725890c1fcfe585be1688 (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
{
  description = "Your new nix config";

  inputs = {
    # Nixpkgs
    nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";

    # Home manager
    home-manager.url = "github:nix-community/home-manager/release-25.11";
    home-manager.inputs.nixpkgs.follows = "nixpkgs";

    hyprland.url = "github:hyprwm/Hyprland";
    serpantinum.url = "github:ilyamiro/serpantinum";
    spicetify-nix.url = "github:Gerg-L/spicetify-nix";
    
    ocnix.url = "github:albertov/opencode-nix";
    opencode.url = "github:sst/opencode";

    helium-flake.url = "github:oxcl/nix-flake-helium-browser";
    helium-flake.inputs.nixpkgs.follows = "nixpkgs";
    lanzaboote = {
      url = "github:nix-community/lanzaboote/v0.4.3";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = {
    self,
    nixpkgs,
    home-manager,
    ocnix,
    opencode,
    ...
  } @ inputs: let
    mkHost = {
      hostname,
      system ? "x86_64-linux",
      modules ? [],
    }:
      nixpkgs.lib.nixosSystem {
        inherit system;
        specialArgs = { inherit inputs; };
        modules =
          [
            {
              networking.hostName = hostname;
              nixpkgs.overlays = [ ocnix.overlays.default ];
            }
            ocnix.nixosModules.opencode
            home-manager.nixosModules.home-manager
            ./nixos/common.nix
            {
              home-manager.useGlobalPkgs = true;
              home-manager.useUserPackages = true;
              home-manager.backupFileExtension = "backup";
              home-manager.extraSpecialArgs = { inherit inputs; };
              home-manager.users.phos = import ./home-manager/home.nix;
            }
          ]
          ++ modules;
      };
  in {
    # NixOS configuration entrypoint
    # Available through 'nixos-rebuild --flake .#your-hostname'
    nixosConfigurations = {
      phosphophyllite = mkHost {
        hostname = "phosphophyllite";
        modules = [
          ./hosts/phosphophyllite
        ];
      };

      # Add your laptop here when ready.
      # laptop-hostname = mkHost {
      #   hostname = "laptop-hostname";
      #   modules = [ ./hosts/laptop ];
      # };
    };

    # Standalone home-manager configuration entrypoint
    # Available through 'home-manager --flake .#your-username@your-hostname'
    homeConfigurations = {
      # FIXME replace with your username@hostname
      "phos@phosphophyllite" = home-manager.lib.homeManagerConfiguration {
        # Home-manager requires 'pkgs' instance
        pkgs = nixpkgs.legacyPackages.x86_64-linux; # FIXME replace x86_64-linux with your architecture 
        extraSpecialArgs = {inherit inputs;};
        # > Our main home-manager configuration file <
        modules = [./home-manager/home.nix];
      };
    };
  };
}