Minimal flake for darwin

This commit is contained in:
Cyryl Płotnicki 2022-03-10 12:21:27 +00:00
parent 65a70e5a80
commit 28c7af45d3
11 changed files with 133 additions and 24 deletions

45
INSTALL_MACOS.md Normal file
View file

@ -0,0 +1,45 @@
## Nix
sh <(curl -L https://nixos.org/nix/install)
Add
```
# Nix
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi
# End Nix
``` to `/etc/zshrc`
[restart]
## nix-darwin
nix-build https://github.com/LnL7/nix-darwin/archive/master.tar.gz -A installer
add
```
services.nix-daemon.enable = true;
nix = {
useDaemon = true;
gc.automatic = true;
package = pkgs.nixUnstable;
extraOptions = ''
experimental-features = nix-command flakes
'';
};
``` to `~/.nixpkgs/darwin-configuration.nix
./result/bin/darwin-installer
darwin-rebuild switch
[restart]
add
```
experimental-features = nix-command flakes
``` to `/etc/nix/nix.conf`
## home-manager
nix build .#darwinConfigurations.macmini.system
darwin-rebuild build --flake '.

View file

@ -19,6 +19,27 @@
"type": "github" "type": "github"
} }
}, },
"darwin": {
"inputs": {
"nixpkgs": [
"nixpkgs-stable"
]
},
"locked": {
"lastModified": 1645293039,
"narHash": "sha256-PwdDu+SkX8dreeuJ/4av1sEluNZdrpdXv8JsRKKg1Yc=",
"owner": "lnl7",
"repo": "nix-darwin",
"rev": "1df878b6f8351795a3bebfbe4fd2d02e1e8b29d6",
"type": "github"
},
"original": {
"owner": "lnl7",
"ref": "master",
"repo": "nix-darwin",
"type": "github"
}
},
"flake-compat": { "flake-compat": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -223,6 +244,7 @@
"root": { "root": {
"inputs": { "inputs": {
"agenix": "agenix", "agenix": "agenix",
"darwin": "darwin",
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"home-manager": "home-manager", "home-manager": "home-manager",
"neuron": "neuron", "neuron": "neuron",

View file

@ -1,7 +1,8 @@
{ {
description = "NixOS configuration with flakes"; description = "NixOS configuration with flakes";
outputs = { self, flake-utils, home-manager, nixpkgs-nixos-unstable outputs = { self, flake-utils, home-manager, nixpkgs-nixos-unstable
, nixpkgs-stable, nixos-hardware, nur, agenix, neuron, sops }@inputs: , nixpkgs-stable, darwin, nixos-hardware, nur, agenix, neuron, sops
}@inputs:
let let
mkServer = pkgs: system: hostname: mkServer = pkgs: system: hostname:
@ -33,7 +34,7 @@
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
home-manager.users.cyryl = { home-manager.users.cyryl = {
imports = [ ./nixos/home-manager ]; imports = [ ./nixos/home-manager ./nixos/home-manager/linux.nix ];
_module.args.inputs = inputs; _module.args.inputs = inputs;
}; };
} }
@ -47,8 +48,23 @@
}; };
}; };
}; };
in { in {
darwinConfigurations."macmini" = darwin.lib.darwinSystem {
system = "x86_64-darwin";
modules = [
(./. + "/nixos/boxes/macmini")
home-manager.darwinModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.cyryl = {
imports = [ ./nixos/home-manager ];
};
}
];
};
nixosConfigurations = { nixosConfigurations = {
foureighty = mkWorkstation nixpkgs-stable "x86_64-linux" "foureighty"; foureighty = mkWorkstation nixpkgs-stable "x86_64-linux" "foureighty";
skinnyv = mkWorkstation nixpkgs-stable "x86_64-linux" "skinnyv"; skinnyv = mkWorkstation nixpkgs-stable "x86_64-linux" "skinnyv";
@ -116,6 +132,11 @@
ref = "master"; ref = "master";
}; };
darwin = {
url = "github:lnl7/nix-darwin/master";
inputs.nixpkgs.follows = "nixpkgs-stable";
};
home-manager = { home-manager = {
type = "github"; type = "github";
owner = "nix-community"; owner = "nix-community";

View file

@ -0,0 +1,26 @@
{ config, pkgs, inputs, lib, nixpkgs-nixos-unstable-and-unfree, ... }: {
environment.systemPackages = with pkgs; [ vim nixfmt ];
imports = [
../../git
../../mercurial
];
services.nix-daemon.enable = true;
nix = {
useDaemon = true;
gc.automatic = true;
package = pkgs.nixUnstable;
extraOptions = ''
experimental-features = nix-command flakes
'';
};
programs.zsh.enable = true; # default shell on catalina
system.stateVersion = 4;
home-manager.users.cyryl = { ... }: {
imports = [ ];
home.packages = [ ];
};
}

View file

@ -20,7 +20,6 @@
fstrim.enable = true; fstrim.enable = true;
clipmenu.enable = true; clipmenu.enable = true;
lorri.enable = true; lorri.enable = true;
keybase.enable = true;
avahi = { avahi = {
enable = true; enable = true;

View file

@ -17,7 +17,6 @@
curl curl
tmux tmux
htop htop
atop
home-manager home-manager
pciutils pciutils
powertop powertop

View file

@ -38,7 +38,6 @@ in
home.packages = with pkgs; with pkgs.gnome3; with pkgs.python38Packages; [ home.packages = with pkgs; with pkgs.gnome3; with pkgs.python38Packages; [
anarchism anarchism
apvlv
binwalk-full binwalk-full
brave brave
cheese cheese
@ -55,7 +54,6 @@ in
gnome-screenshot gnome-screenshot
gsettings-desktop-schemas gsettings-desktop-schemas
inkscape inkscape
keybase-gui
libreoffice libreoffice
mindforger mindforger
modem-manager-gui modem-manager-gui

View file

@ -2,14 +2,11 @@
{ {
home.packages = with pkgs; [ home.packages = with pkgs; [
(pass.withExtensions (ext: [ ext.pass-otp ext.pass-import ext.pass-genphrase ext.pass-audit ext.pass-update ])) (pass.withExtensions (ext: [ ext.pass-otp ext.pass-import ext.pass-genphrase ext.pass-audit ext.pass-update ]))
apvlv
aria aria
atop
bfg-repo-cleaner bfg-repo-cleaner
binutils binutils
bitwarden-cli bitwarden-cli
bottom bottom
btrfs-progs
curl curl
dnsutils dnsutils
docker-compose docker-compose
@ -25,9 +22,7 @@
imagemagick imagemagick
jmtpfs jmtpfs
jq jq
keybase
kopia kopia
lm_sensors
mercurial mercurial
minicom minicom
nix-index nix-index
@ -35,7 +30,6 @@
nixfmt nixfmt
nixpkgs-fmt nixpkgs-fmt
pciutils pciutils
powertop
ranger ranger
restic restic
ripgrep-all ripgrep-all
@ -45,6 +39,5 @@
unzip unzip
wget wget
whois whois
wirelesstools
]; ];
} }

View file

@ -10,17 +10,8 @@
news.display = "show"; news.display = "show";
home.packages = with pkgs; [ home.packages = with pkgs; [
nerdfonts
glibcLocales
]; ];
services.gpg-agent = {
enable = true;
pinentryFlavor = "curses";
};
services.kbfs.enable = true;
imports = [ imports = [
./programs/tmux.nix ./programs/tmux.nix
./programs/zsh.nix ./programs/zsh.nix

View file

@ -0,0 +1,16 @@
{ config, pkgs, inputs, ... }:
{
services.gpg-agent = {
enable = true;
pinentryFlavor = "curses";
};
home.packages = with pkgs; [
atop
btrfs-progs
glibcLocales
lm_sensors
nerdfonts
powertop
wirelesstools
];
}

View file

@ -55,7 +55,6 @@ in
}; };
home.packages = with pkgs; [ home.packages = with pkgs; [
aria aria
atop
bfg-repo-cleaner bfg-repo-cleaner
curl curl
dnsutils dnsutils