diff --git a/INSTALL_MACOS.md b/INSTALL_MACOS.md new file mode 100644 index 00000000..e95c6103 --- /dev/null +++ b/INSTALL_MACOS.md @@ -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 '. + diff --git a/flake.lock b/flake.lock index 24c4e494..1b3ea3b7 100644 --- a/flake.lock +++ b/flake.lock @@ -19,6 +19,27 @@ "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": false, "locked": { @@ -223,6 +244,7 @@ "root": { "inputs": { "agenix": "agenix", + "darwin": "darwin", "flake-utils": "flake-utils", "home-manager": "home-manager", "neuron": "neuron", diff --git a/flake.nix b/flake.nix index 9ce1a656..5d479a6d 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,8 @@ { description = "NixOS configuration with flakes"; 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 mkServer = pkgs: system: hostname: @@ -33,7 +34,7 @@ home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; home-manager.users.cyryl = { - imports = [ ./nixos/home-manager ]; + imports = [ ./nixos/home-manager ./nixos/home-manager/linux.nix ]; _module.args.inputs = inputs; }; } @@ -47,8 +48,23 @@ }; }; }; - 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 = { foureighty = mkWorkstation nixpkgs-stable "x86_64-linux" "foureighty"; skinnyv = mkWorkstation nixpkgs-stable "x86_64-linux" "skinnyv"; @@ -116,6 +132,11 @@ ref = "master"; }; + darwin = { + url = "github:lnl7/nix-darwin/master"; + inputs.nixpkgs.follows = "nixpkgs-stable"; + }; + home-manager = { type = "github"; owner = "nix-community"; diff --git a/nixos/boxes/macmini/default.nix b/nixos/boxes/macmini/default.nix new file mode 100644 index 00000000..776f434e --- /dev/null +++ b/nixos/boxes/macmini/default.nix @@ -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 = [ ]; + }; +} diff --git a/nixos/common-services.nix b/nixos/common-services.nix index 7ffd8f91..22e664d8 100644 --- a/nixos/common-services.nix +++ b/nixos/common-services.nix @@ -20,7 +20,6 @@ fstrim.enable = true; clipmenu.enable = true; lorri.enable = true; - keybase.enable = true; avahi = { enable = true; diff --git a/nixos/common.nix b/nixos/common.nix index 8e8d34d1..f0b2c78b 100644 --- a/nixos/common.nix +++ b/nixos/common.nix @@ -17,7 +17,6 @@ curl tmux htop - atop home-manager pciutils powertop diff --git a/nixos/gui/default.nix b/nixos/gui/default.nix index 4b70b5cf..6752424d 100644 --- a/nixos/gui/default.nix +++ b/nixos/gui/default.nix @@ -38,7 +38,6 @@ in home.packages = with pkgs; with pkgs.gnome3; with pkgs.python38Packages; [ anarchism - apvlv binwalk-full brave cheese @@ -55,7 +54,6 @@ in gnome-screenshot gsettings-desktop-schemas inkscape - keybase-gui libreoffice mindforger modem-manager-gui diff --git a/nixos/home-manager/cli.nix b/nixos/home-manager/cli.nix index c9c8c7c7..c4b91720 100644 --- a/nixos/home-manager/cli.nix +++ b/nixos/home-manager/cli.nix @@ -2,14 +2,11 @@ { home.packages = with pkgs; [ (pass.withExtensions (ext: [ ext.pass-otp ext.pass-import ext.pass-genphrase ext.pass-audit ext.pass-update ])) - apvlv aria - atop bfg-repo-cleaner binutils bitwarden-cli bottom - btrfs-progs curl dnsutils docker-compose @@ -25,9 +22,7 @@ imagemagick jmtpfs jq - keybase kopia - lm_sensors mercurial minicom nix-index @@ -35,7 +30,6 @@ nixfmt nixpkgs-fmt pciutils - powertop ranger restic ripgrep-all @@ -45,6 +39,5 @@ unzip wget whois - wirelesstools ]; } diff --git a/nixos/home-manager/default.nix b/nixos/home-manager/default.nix index 2b80cdb4..89aefe44 100644 --- a/nixos/home-manager/default.nix +++ b/nixos/home-manager/default.nix @@ -10,17 +10,8 @@ news.display = "show"; home.packages = with pkgs; [ - nerdfonts - glibcLocales ]; - services.gpg-agent = { - enable = true; - pinentryFlavor = "curses"; - }; - - services.kbfs.enable = true; - imports = [ ./programs/tmux.nix ./programs/zsh.nix diff --git a/nixos/home-manager/linux.nix b/nixos/home-manager/linux.nix new file mode 100644 index 00000000..2644c0fd --- /dev/null +++ b/nixos/home-manager/linux.nix @@ -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 + ]; +} \ No newline at end of file diff --git a/nixos/home-other-os.nix b/nixos/home-other-os.nix index bbdcbc29..1720bf7c 100644 --- a/nixos/home-other-os.nix +++ b/nixos/home-other-os.nix @@ -55,7 +55,6 @@ in }; home.packages = with pkgs; [ aria - atop bfg-repo-cleaner curl dnsutils