forked from juspay/nixos-unified-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
55 lines (48 loc) · 1.84 KB
/
flake.nix
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
{
inputs = {
# Principle inputs (updated by `nix run .#update`)
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
flake-parts.url = "github:hercules-ci/flake-parts";
nixos-flake.url = "github:srid/nixos-flake";
};
outputs = inputs@{ self, ... }:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" "aarch64-darwin" "x86_64-darwin" ];
imports = [
inputs.nixos-flake.flakeModule
];
flake.homeModules.default = ./home.nix;
flake.templates.default = {
description = "A `home-manager` template providing useful tools & settings for Nix-based development";
path = builtins.path {
path = ./.;
filter = path: _:
inputs.nixpkgs.lib.hasSuffix ".nix" path ||
inputs.nixpkgs.lib.hasSuffix ".lock" path;
};
};
perSystem = { self', pkgs, ... }:
let
# TODO: Change username
myUserName = "juspay";
in
{
legacyPackages.homeConfigurations.${myUserName} =
self.nixos-flake.lib.mkHomeConfiguration
pkgs
({ pkgs, ... }: {
imports = [ self.homeModules.default ];
home.username = myUserName;
home.homeDirectory = "/${if pkgs.stdenv.isDarwin then "Users" else "home"}/${myUserName}";
home.stateVersion = "22.11";
});
# Enables 'nix run' to activate.
apps.default.program = self'.packages.activate-home;
# Enable 'nix build' to build the home configuration, but without
# activating.
packages.default = self'.legacyPackages.homeConfigurations.${myUserName}.activationPackage;
};
};
}