Home

dotnix @10c850fdca56c0e8fc0b0c025d3af74dd02e6939 - refs - log -
-
https://git.jolheiser.com/dotnix.git
My nix dotfiles
dotnix / flake.nix
- raw
  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
{
  description = "jolheiser's nixos config";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
    home-manager.url = "github:nix-community/home-manager";
    home-manager.inputs.nixpkgs.follows = "nixpkgs";
    agenix.url = "github:ryantm/agenix";
    agenix.inputs = {
      nixpkgs.follows = "nixpkgs";
      darwin.follows = "";
    };
    flake-utils.url = "github:numtide/flake-utils";

    nur.url = "github:nix-community/nur";
    jolheiser-nur.url = "git+https://git.jojodev.com/jolheiser/nur";

    nixpkgs-py36.url = "github:nixos/nixpkgs/34f85de51bbc74595e63b22ee089adbb31f7c7a2";
  };

  outputs = {
    self,
    nixpkgs,
    home-manager,
    agenix,
    jolheiser-nur,
    nixpkgs-py36,
    ...
  } @ inputs: let
    overlays = final: prev: {
      nur = import inputs.nur {
        nurpkgs = prev;
        pkgs = prev;
        repoOverrides = {
          jolheiser = import jolheiser-nur {pkgs = prev;};
        };
      };
    };
    commonConfig = {gui ? true}: {
      config,
      pkgs,
      ...
    }: let
      userSecret = path: {
        file = path;
        owner = username;
      };
    in {
      config = {
        nixpkgs.overlays = [overlays];
        home-manager = {
          useGlobalPkgs = true;
          useUserPackages = true;
          users.${username}.imports =
            if gui
            then [./apps/gui]
            else [./apps/nogui];
          extraSpecialArgs = {
            flakePath = "/home/${username}/.config/nixpkgs";
          };
        };
        age.secrets = {
          ssh-config = userSecret ./secrets/shared/ssh-config.age;
          ssh-config-work = userSecret ./secrets/shared/ssh-config-work.age;
          spotify-pw = userSecret ./secrets/shared/spotify-pw.age;
          irc-pw = userSecret ./secrets/shared/irc-pw.age;
        };
      };
    };
    username = "jolheiser";
  in
    {
      nixosConfigurations = {
        "chai" = nixpkgs.lib.nixosSystem {
          system = "x86_64-linux";
          modules = [
            home-manager.nixosModules.home-manager
            agenix.nixosModules.default
            ./machines/chai
            (commonConfig {})
            ({pkgs, ...}: {
              config = {
                nixpkgs.overlays = [
                  (_: _: {
                    py36 = import nixpkgs-py36 {inherit (pkgs) system;};
                  })
                ];
                home-manager.users.${username}.programs = {
                  git.package = pkgs.gitSVN;
                  firefox.profiles.default.bookmarks = [(import ./apps/gui/firefox/work.nix)];
                };
                age.secrets = {
                  netrc = {
                    file = ./secrets/work/netrc.age;
                    owner = username;
                    path = "/home/${username}/.netrc";
                  };
                  pipconf = {
                    file = ./secrets/work/pip.conf.age;
                    owner = username;
                    path = "/home/${username}/.config/pip/pip.conf";
                  };
                };
              };
            })
          ];
        };
        "matcha" = nixpkgs.lib.nixosSystem {
          system = "x86_64-linux";
          modules = [
            home-manager.nixosModules.home-manager
            agenix.nixosModules.default
            ./machines/matcha
            (commonConfig {})
          ];
        };
        "dragonwell" = nixpkgs.lib.nixosSystem {
          system = "x86_64-linux";
          modules = [
            home-manager.nixosModules.home-manager
            agenix.nixosModules.default
            ./machines/dragonwell
            (commonConfig {gui = false;})
          ];
        };
      };
    }
    // inputs.flake-utils.lib.eachDefaultSystem (system: let
      pkgs = nixpkgs.legacyPackages.${system};
    in {
      devShells.default = pkgs.mkShell {
        nativeBuildInputs = [
          agenix.packages.${system}.agenix
        ];
      };
    });
}