nixos

NixOS server files. Mirror from https://git.nordgedanken.dev/kubernetes/nixos
git clone git://archive.git.mtrnord.blog/MTRNord/nixos.git
Log | Files | Refs | README

flake.nix (4483B)


      1 {
      2   description = "Your new nix config";
      3 
      4   inputs = {
      5     # Nixpkgs
      6     nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
      7     #nixpkgs.url = "github:nixos/nixpkgs/672430223ef43060b460321b50a2e17628c7d8cd";
      8     #nixpkgs-discourse.url = "github:MTRNord/nixpkgs/beee2842bdc9281c94c95ea9c89f20b3da53ffd3";
      9     # You can access packages and modules from different nixpkgs revs
     10     # at the same time. Here's an working example:
     11     nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
     12     # Also see the 'unstable-packages' overlay at 'overlays/default.nix'.
     13 
     14     # Persistence
     15     impermanence.url = "github:nix-community/impermanence";
     16 
     17     # Home manager
     18     home-manager.url = "github:nix-community/home-manager/release-23.11";
     19     home-manager.inputs.nixpkgs.follows = "nixpkgs";
     20 
     21     # TODO: Add any other flake you might need
     22     hardware.url = "github:nixos/nixos-hardware";
     23     sops-nix.url = "github:Mic92/sops-nix";
     24     # Shameless plug: looking for a way to nixify your themes and make
     25     # everything match nicely? Try nix-colors!
     26     # nix-colors.url = "github:misterio77/nix-colors";
     27 
     28     kubenix.url = "github:hall/kubenix";
     29     docker-utils.url = "github:collinarnett/docker-utils";
     30     github_meta = {
     31       url = "https://api.github.com/meta";
     32       flake = false;
     33     };
     34   };
     35 
     36   outputs = {
     37     self,
     38     nixpkgs,
     39     nixpkgs-unstable,
     40     #nixpkgs-discourse,
     41     home-manager,
     42     sops-nix,
     43     docker-utils,
     44     ...
     45   } @ inputs: let
     46     inherit (self) outputs;
     47     forAllSystems = nixpkgs.lib.genAttrs [
     48       "aarch64-linux"
     49       "x86_64-linux"
     50     ];
     51   in rec {
     52     # Your custom packages
     53     # Acessible through 'nix build', 'nix shell', etc
     54     packages = forAllSystems (
     55       system: let
     56         pkgs = nixpkgs.legacyPackages.${system};
     57         build-draupnir = {
     58           # TODO: Pull Draupnir
     59           # TODO: Run yarn describe version task
     60           # TODO: Build image using https://github.com/collinarnett/docker-utils
     61         };
     62       in
     63         import ./pkgs {inherit pkgs;}
     64     );
     65 
     66     # Devshell for bootstrapping
     67     # Acessible through 'nix develop' or 'nix-shell' (legacy)
     68     devShells = forAllSystems (
     69       system: let
     70         pkgs = nixpkgs.legacyPackages.${system};
     71       in
     72         import ./shell.nix {inherit pkgs;}
     73     );
     74 
     75     formatter = forAllSystems (system: let
     76       pkgs = nixpkgs.legacyPackages.${system};
     77     in
     78       pkgs.alejandra);
     79 
     80     # Your custom packages and modifications, exported as overlays
     81     overlays = import ./overlays {
     82       inherit inputs;
     83       pkgs = nixpkgs.legacyPackages.aarch64-linux;
     84     };
     85     # Reusable nixos modules you might want to export
     86     # These are usually stuff you would upstream into nixpkgs
     87     nixosModules = import ./modules/nixos;
     88     # Reusable home-manager modules you might want to export
     89     # These are usually stuff you would upstream into home-manager
     90     homeManagerModules = import ./modules/home-manager;
     91 
     92     # NixOS configuration entrypoint
     93     # Available through 'nixos-rebuild --flake .#your-hostname'
     94     nixosConfigurations = {
     95       worker-1 = nixpkgs.lib.nixosSystem {
     96         specialArgs = {inherit inputs outputs;};
     97         modules = [
     98           # > Our main nixos configuration file <
     99           sops-nix.nixosModules.sops
    100           ./nixos/worker-1/configuration.nix
    101         ];
    102       };
    103       worker-2 = nixpkgs.lib.nixosSystem {
    104         specialArgs = {inherit inputs outputs;};
    105         modules = [
    106           # > Our main nixos configuration file <
    107           sops-nix.nixosModules.sops
    108           ./nixos/worker-2/configuration.nix
    109         ];
    110       };
    111     };
    112 
    113     # Standalone home-manager configuration entrypoint
    114     # Available through 'home-manager --flake .#your-username'
    115     homeConfigurations = {
    116       "marcel@worker-1" = home-manager.lib.homeManagerConfiguration {
    117         pkgs = nixpkgs.legacyPackages.aarch64-linux; # Home-manager requires 'pkgs' instance
    118         extraSpecialArgs = {inherit inputs outputs nixpkgs-unstable;};
    119         modules = [
    120           # > Our main home-manager configuration file <
    121           ./home-manager/home.nix
    122         ];
    123       };
    124       "marcel@worker-2" = home-manager.lib.homeManagerConfiguration {
    125         pkgs = nixpkgs.legacyPackages.aarch64-linux; # Home-manager requires 'pkgs' instance
    126         extraSpecialArgs = {inherit inputs outputs nixpkgs-unstable;};
    127         modules = [
    128           # > Our main home-manager configuration file <
    129           ./home-manager/home.nix
    130         ];
    131       };
    132     };
    133   };
    134 }