diff --git a/flake.lock b/flake.lock index 2996788..28d17cc 100644 --- a/flake.lock +++ b/flake.lock @@ -41,6 +41,27 @@ "type": "github" } }, + "nixos-apple-silicon": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ], + "rust-overlay": "rust-overlay" + }, + "locked": { + "lastModified": 1675215747, + "narHash": "sha256-O7vwx67l2PNnkNpPXnp7D0oBW+OfFetxdrlwUtaweY4=", + "owner": "tpwrules", + "repo": "nixos-apple-silicon", + "rev": "0086dd0e401f9dde826e6c170d312a87564aa6a4", + "type": "github" + }, + "original": { + "owner": "tpwrules", + "repo": "nixos-apple-silicon", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1675454231, @@ -76,10 +97,27 @@ "inputs": { "darwin": "darwin", "home-manager": "home-manager", + "nixos-apple-silicon": "nixos-apple-silicon", "nixpkgs": "nixpkgs", "nur": "nur" } }, + "rust-overlay": { + "flake": false, + "locked": { + "lastModified": 1675132198, + "narHash": "sha256-izOVjdIfdv0OzcfO9rXX0lfGkQn4tdJ0eNm3P3LYo/o=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "48b1403150c3f5a9aeee8bc4c77c8926f29c6501", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, "utils": { "locked": { "lastModified": 1667395993, diff --git a/flake.nix b/flake.nix index 9d1647e..59d4b11 100644 --- a/flake.nix +++ b/flake.nix @@ -7,23 +7,23 @@ darwin.inputs.nixpkgs.follows = "nixpkgs"; home-manager.url = "github:nix-community/home-manager"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; + nixos-apple-silicon.url = "github:tpwrules/nixos-apple-silicon"; + nixos-apple-silicon.inputs.nixpkgs.follows = "nixpkgs"; nur.url = "github:nix-community/NUR"; }; - outputs = inputs@{ self, nixpkgs, home-manager, darwin, nur, ... }: + outputs = inputs@{ self, nixpkgs, home-manager, darwin, nixos-apple-silicon, nur, ... }: let - pkgsfunc = (system: import nixpkgs { - inherit system; - overlays = [ - (import ./overlays) - ]; - config = { - allowUnfree = true; - packageOverrides = pkgs: { - nur = import nur { inherit pkgs; nurpkgs = pkgs; }; + pkgsfunc = ({ system, overlays ? [ ] }: import nixpkgs + { + inherit system overlays; + config = { + allowUnfree = true; + packageOverrides = pkgs: { + nur = import nur { inherit pkgs; nurpkgs = pkgs; }; + }; }; - }; - }); + }); user-config = (pkgs: { home-manager.useGlobalPkgs = true; @@ -46,28 +46,46 @@ system = "aarch64-darwin"; - pkgs = pkgsfunc system; + pkgs = pkgsfunc { inherit system; overlays = [ (import ./overlays) ]; }; modules = [ ./modules/nix.nix - ./system/darwin.nix + ./system/zeus.darwin.nix + ./system/common.nix home-manager.darwinModules.home-manager (user-config pkgs) ]; }; }; - nixosConfigurations.zeus-utm-vm = nixpkgs.lib.nixosSystem rec { + + nixosConfigurations.zeus-utmvm = nixpkgs.lib.nixosSystem rec { system = "aarch64-linux"; - pkgs = pkgsfunc system; + pkgs = pkgsfunc { inherit system; }; specialArgs = { inherit inputs; }; modules = [ - ./modules/nix.nix - ./system/utm-arm-vm.nix home-manager.nixosModules.home-manager (user-config pkgs) + ./modules/nix.nix + ./system/zeus.utmvm.nix + ]; + }; + + nixosConfigurations.zeus-asahi = nixpkgs.lib.nixosSystem rec { + system = "aarch64-linux"; + + pkgs = pkgsfunc { inherit system; overlays = [ nixos-apple-silicon.overlays ]; }; + + specialArgs = { inherit inputs; }; + + modules = [ + nixos-apple-silicon.nixosModules.apple-silicon-support + home-manager.nixosModules.home-manager + (user-config pkgs) + ./modules/nix.nix + ./system/zeus.asahi.nix ]; }; }; diff --git a/system/nixos.common.nix b/system/nixos.common.nix new file mode 100644 index 0000000..b47be8e --- /dev/null +++ b/system/nixos.common.nix @@ -0,0 +1,28 @@ +{ pkgs, ... }: + +{ + imports = [ ./common.nix ]; + + console.keyMap = "colemak"; + + i18n.defaultLocale = "en_US.UTF-8"; + + programs.command-not-found.enable = false; + + programs.zsh.loginShellInit = '' + reexec() { + unset __NIX_OS_SET_ENVIRONMENT_DONE + unset __ETC_ZPROFILE_SOURCED __ETC_ZSHENV_SOURCED __ETC_ZSHRC_SOURCED + exec $SHELL -c 'echo >&2 "reexecuting shell: $SHELL" && exec $SHELL -l' + } + ''; + + services.udev.enable = true; + + system.stateVersion = "22.11"; + + users.users.willem = { + isNormalUser = true; + extraGroups = [ "networkmanager" "wheel" ]; + }; +} diff --git a/system/nixos.desktop.nix b/system/nixos.desktop.nix new file mode 100644 index 0000000..349a827 --- /dev/null +++ b/system/nixos.desktop.nix @@ -0,0 +1,32 @@ +{ pkgs, ... }: + +{ + environment.systemPackages = with pkgs; [ + freecad + qbittorrent + vlc + ]; + + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + + services.printing.enable = true; + + hardware.pulseaudio.enable = false; + + security.rtkit.enable = true; + + services.xserver = { + enable = true; + layout = "us"; + libinput.mouse.naturalScrolling = true; + libinput.touchpad.naturalScrolling = true; + xkbVariant = "colemak"; + }; + + sound.enable = true; +} diff --git a/system/nixos.gnome.nix b/system/nixos.gnome.nix new file mode 100644 index 0000000..4511292 --- /dev/null +++ b/system/nixos.gnome.nix @@ -0,0 +1,34 @@ +{ pkgs, ... }: + +{ + imports = [ ./nixos.desktop.nix ]; + + environment.gnome.excludePackages = (with pkgs; [ + gnome-photos + gnome-tour + ]) ++ (with pkgs.gnome; [ + cheese # webcam tool + gnome-music + gedit # text editor + epiphany # web browser + geary # email reader + evince # document viewer + gnome-characters + totem # video player + tali # poker game + iagno # go game + hitori # sudoku game + atomix # puzzle game + ]); + + environment.systemPackages = with pkgs; [ + pinentry-gnome + ]; + + services.xserver = { + displayManager.gdm.enable = true; + desktopManager.gnome.enable = true; + }; + + sound.enable = true; +} diff --git a/system/nixos.nix b/system/nixos.nix deleted file mode 100644 index 63c2a08..0000000 --- a/system/nixos.nix +++ /dev/null @@ -1,80 +0,0 @@ -{ pkgs, ... }: - -{ - imports = [ ./common.nix ]; - - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - boot.loader.efi.efiSysMountPoint = "/boot/efi"; - - console.keyMap = "colemak"; - - environment.gnome.excludePackages = (with pkgs; [ - gnome-photos - gnome-tour - ]) ++ (with pkgs.gnome; [ - cheese # webcam tool - gnome-music - gedit # text editor - epiphany # web browser - geary # email reader - evince # document viewer - gnome-characters - totem # video player - tali # poker game - iagno # go game - hitori # sudoku game - atomix # puzzle game - ]); - - environment.systemPackages = with pkgs; [ - freecad - pinentry-gnome - qbittorrent - vlc - ]; - - i18n.defaultLocale = "en_US.UTF-8"; - - programs.command-not-found.enable = false; - - programs.zsh.loginShellInit = '' - reexec() { - unset __NIX_OS_SET_ENVIRONMENT_DONE - unset __ETC_ZPROFILE_SOURCED __ETC_ZSHENV_SOURCED __ETC_ZSHRC_SOURCED - exec $SHELL -c 'echo >&2 "reexecuting shell: $SHELL" && exec $SHELL -l' - } - ''; - - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - }; - - services.printing.enable = true; - - hardware.pulseaudio.enable = false; - - security.rtkit.enable = true; - - services.xserver = { - enable = true; - displayManager.gdm.enable = true; - desktopManager.gnome.enable = true; - layout = "us"; - libinput.mouse.naturalScrolling = true; - libinput.touchpad.naturalScrolling = true; - xkbVariant = "colemak"; - }; - - sound.enable = true; - - system.stateVersion = "22.11"; - - users.users.willem = { - isNormalUser = true; - extraGroups = [ "networkmanager" "wheel" ]; - }; -} diff --git a/system/zeus.asahi.nix b/system/zeus.asahi.nix new file mode 100644 index 0000000..6f2fa9f --- /dev/null +++ b/system/zeus.asahi.nix @@ -0,0 +1,15 @@ +{ pkgs, ... }: + +{ + imports = [ ./nixos.common.nix ./nixos.gnome.nix ]; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = false; + + fileSystems."/" = { + device = "/dev/disk/by-label/nixos"; + fsType = "ext4"; + }; + + networking.hostName = "zeus-asahi"; +} diff --git a/system/darwin.nix b/system/zeus.darwin.nix similarity index 99% rename from system/darwin.nix rename to system/zeus.darwin.nix index 0f8d71c..f5a1644 100644 --- a/system/darwin.nix +++ b/system/zeus.darwin.nix @@ -2,7 +2,7 @@ { imports = [ ./common.nix ]; - + environment.etc."nix/user-sandbox.sb".text = '' (version 1) (allow default) diff --git a/system/utm-arm-vm.nix b/system/zeus.utmvm.nix similarity index 53% rename from system/utm-arm-vm.nix rename to system/zeus.utmvm.nix index 5ee2258..8af4ae1 100644 --- a/system/utm-arm-vm.nix +++ b/system/zeus.utmvm.nix @@ -1,22 +1,29 @@ { pkgs, ... }: { - imports = [ ./nixos.nix ]; + imports = [ ./nixos.common.nix ./nixos.gnome.nix ]; + + boot.extraModulePackages = [ ]; boot.initrd.availableKernelModules = [ "xhci_pci" "virtio_pci" "usbhid" "usb_storage" "sr_mod" ]; boot.initrd.kernelModules = [ ]; - boot.extraModulePackages = [ ]; + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.loader.efi.efiSysMountPoint = "/boot/efi"; + fileSystems."/" = { - device = "/dev/disk/by-uuid/10c8feb5-8fbb-490a-b144-dff00e82f3e9"; + device = "/dev/disk/by-label/nixos"; fsType = "ext4"; }; fileSystems."/boot/efi" = { - device = "/dev/disk/by-uuid/3D0E-803C"; + device = "/dev/disk/by-label/BOOT"; fsType = "vfat"; }; + networking.hostName = "zeus-utmvm"; + services.spice-vdagentd.enable = true; swapDevices = [ ];