Set up flakes and nix-darwin

This commit is contained in:
Natsu Kagami 2021-10-26 14:25:19 -04:00
parent 5aaab3d2bb
commit ce855bb3ae
6 changed files with 165 additions and 4 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
home.nix
/result

30
darwin/configuration.nix Normal file
View file

@ -0,0 +1,30 @@
{ config, pkgs, ... }:
{
# List packages installed in system profile. To search by name, run:
# $ nix-env -qaP | grep wget
environment.systemPackages =
[ pkgs.vim
];
# Use a custom configuration.nix location.
# $ darwin-rebuild switch -I darwin-config=$HOME/.config/nixpkgs/darwin/configuration.nix
# environment.darwinConfig = "$HOME/.config/nixpkgs/darwin/configuration.nix";
# Auto upgrade nix package and the daemon service.
# services.nix-daemon.enable = true;
nix.package = pkgs.nixUnstable;
# Create /etc/bashrc that loads the nix-darwin environment.
programs.zsh.enable = true; # default shell on catalina
# programs.fish.enable = true;
# Used for backwards compatibility, please read the changelog before changing.
# $ darwin-rebuild changelog
system.stateVersion = 4;
users.users.nki = {
name = "nki";
home = "/Users/nki";
};
}

View file

@ -1,7 +1,7 @@
{ config, pkgs, ... }:
{ config, pkgs, nixpkgs-unstable, ... }:
let
pkgsUnstable = import <nixpkgs-unstable> {};
pkgsUnstable = import nixpkgs-unstable { system = pkgs.system; };
in
{
programs.fish = {

99
flake.lock Normal file
View file

@ -0,0 +1,99 @@
{
"nodes": {
"darwin": {
"inputs": {
"nixpkgs": [
"nixpkgs-unstable"
]
},
"locked": {
"lastModified": 1634994402,
"narHash": "sha256-xmlCVVOYGpZoxgOqsDOVF0B0ASrnbNGVAEzID9qh2xo=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "44da835ac40dab5fd231298b59d83487382d2fab",
"type": "github"
},
"original": {
"owner": "lnl7",
"ref": "master",
"repo": "nix-darwin",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1635123562,
"narHash": "sha256-kYuwQqHXDYxy5ijpm8SvCoPNx0br1TpoWeTIOEwOYvA=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "da8a78eec9f7adb57f9e961d1da64805efacff37",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1635268020,
"narHash": "sha256-oaWU7ZvobClXLrQGj7Xvjs2vSlItPFkw/usKh/2c56Y=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "89a27a2e6f54993224f804e50a29e48b8c83d1ca",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1635214691,
"narHash": "sha256-65D0Q6fAKzX3ZGlJSTZGj4jbIB7fttZ8FD754AOYeiQ=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "30f73c6493b4877753da54bfafd1aef90f0eebdf",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1622516815,
"narHash": "sha256-ZjBd81a6J3TwtlBr3rHsZspYUwT9OdhDk+a/SgSEf7I=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "7e9b0dff974c89e070da1ad85713ff3c20b0ca97",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "21.05",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"darwin": "darwin",
"home-manager": "home-manager",
"nixpkgs": "nixpkgs_2",
"nixpkgs-unstable": "nixpkgs-unstable"
}
}
},
"root": "root",
"version": 7
}

31
flake.nix Normal file
View file

@ -0,0 +1,31 @@
{
description = "nki's darwin system";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/21.05";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";
darwin.url = "github:lnl7/nix-darwin/master";
darwin.inputs.nixpkgs.follows = "nixpkgs-unstable";
home-manager.url = "github:nix-community/home-manager";
};
outputs = { self, darwin, nixpkgs, nixpkgs-unstable, home-manager }: {
darwinConfigurations."nki-macbook" = darwin.lib.darwinSystem rec {
system = "aarch64-darwin";
modules = [
./darwin/configuration.nix
home-manager.darwinModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = { inherit nixpkgs-unstable; };
home-manager.users.nki = import ./macbook-home.nix;
}
];
inputs = {
inherit darwin nixpkgs-unstable;
nixpkgs = nixpkgs-unstable;
};
};
};
}

View file

@ -1,7 +1,7 @@
{ config, pkgs, ... }:
{ config, pkgs, nixpkgs-unstable, ... }:
let
x86pkgs = import <nixpkgs> { config.allowUnsupportedSystem = true; };
x86pkgs = import nixpkgs-unstable { system = pkgs.system; config.allowUnsupportedSystem = true; };
in
{
imports = [ ./common.nix ];