From f0aab13dda6091a7a8da180c4142e55a2443523f Mon Sep 17 00:00:00 2001 From: Polen Date: Wed, 30 Oct 2024 22:21:42 -0400 Subject: [PATCH] pi config working --- Makefile | 2 ++ devices/pi/configuration.nix | 33 ++++++++---------- devices/xps13/configuration.nix | 7 ++-- flake.lock | 60 ++++++++++++++++++++++++++++++--- flake.nix | 49 ++++++++++++++++----------- 5 files changed, 105 insertions(+), 46 deletions(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0549fd4 --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +build-pi-image: + nix build .#nixosConfigurations.pi.config.system.build.sdImage --print-out-paths diff --git a/devices/pi/configuration.nix b/devices/pi/configuration.nix index 3defff4..c70b039 100644 --- a/devices/pi/configuration.nix +++ b/devices/pi/configuration.nix @@ -2,20 +2,9 @@ let user = "polen"; - password = "guest"; - SSID = "Cogeco-F710"; - SSIDpassword = "mypassword"; - interface = "wlan0"; + password = "password"; hostname = "pi"; in { - # imports = [ - # inputs.sops-nix.nixosModules.ops - # ]; - - # sops.defaultSopsFile = ../../secrets/secrets.yaml; - # sops.defaultSopsFormat = "yaml"; - # sops.age.keyFile = "/home/polen/.config/sops/age/keys.txt"; - boot = { kernelPackages = pkgs.linuxKernel.packages.linux_rpi3; initrd.availableKernelModules = [ "xhci_pci" "usbhid" "usb_storage" ]; @@ -34,24 +23,30 @@ in { }; networking = { + networkmanager.enable = true; + wireless.enable = false; hostName = hostname; - wireless = { - enable = true; - networks."${SSID}".psk = SSIDpassword; - interfaces = [ interface ]; - }; }; - environment.systemPackages = with pkgs; [ nvim ]; + environment.systemPackages = with pkgs; [ + neovim + tmux + curl + wget + git + ranger + ]; services.openssh.enable = true; + virtualisation.docker.enable = true; + users = { mutableUsers = false; users."${user}" = { isNormalUser = true; password = password; - extraGroups = [ "wheel" ]; + extraGroups = [ "wheel" "docker" ]; }; }; diff --git a/devices/xps13/configuration.nix b/devices/xps13/configuration.nix index 87937f7..c36265a 100644 --- a/devices/xps13/configuration.nix +++ b/devices/xps13/configuration.nix @@ -15,8 +15,6 @@ }; services.blueman.enable = true; - virtualisation.waydroid.enable = true; - # Bootloader. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; @@ -25,6 +23,9 @@ # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. nix.settings.experimental-features = [ "nix-command" "flakes" ]; + nix.settings.extra-platforms = config.boot.binfmt.emulatedSystems; + boot.binfmt.emulatedSystems = ["aarch64-linux"]; + # Configure network proxy if necessary # networking.proxy.default = "http://user:password@proxy:port/"; @@ -58,7 +59,6 @@ extraGroups = [ "networkmanager" "wheel" ]; shell = pkgs.zsh; }; - #users.defaultUserShell = pkgs.zsh # Allow unfree packages nixpkgs.config.allowUnfree = true; @@ -75,6 +75,7 @@ home-manager sops + # Desktop waybar mako swww diff --git a/flake.lock b/flake.lock index 0a06956..aa81e6d 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1718530797, - "narHash": "sha256-pup6cYwtgvzDpvpSCFh1TEUjw2zkNpk8iolbKnyFmmU=", + "lastModified": 1729880355, + "narHash": "sha256-RP+OQ6koQQLX5nw0NmcDrzvGL8HDLnyXt/jHhL1jwjM=", "owner": "nixos", "repo": "nixpkgs", - "rev": "b60ebf54c15553b393d144357375ea956f89e9a9", + "rev": "18536bf04cd71abd345f9579158841376fdd0c5a", "type": "github" }, "original": { @@ -16,9 +16,61 @@ "type": "github" } }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1729973466, + "narHash": "sha256-knnVBGfTCZlQgxY1SgH0vn2OyehH9ykfF8geZgS95bk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "cd3e8833d70618c4eea8df06f95b364b016d4950", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "release-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1729951556, + "narHash": "sha256-bpb6r3GjzhNW8l+mWtRtLNg5PhJIae041sPyqcFNGb4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4e0eec54db79d4d0909f45a88037210ff8eaffee", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "sops-nix": "sops-nix" + } + }, + "sops-nix": { + "inputs": { + "nixpkgs": "nixpkgs_2", + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1729999681, + "narHash": "sha256-qm0uCtM9bg97LeJTKQ8dqV/FvqRN+ompyW4GIJruLuw=", + "owner": "Mic92", + "repo": "sops-nix", + "rev": "1666d16426abe79af5c47b7c0efa82fd31bf4c56", + "type": "github" + }, + "original": { + "owner": "Mic92", + "repo": "sops-nix", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index 9851852..44c1acd 100644 --- a/flake.nix +++ b/flake.nix @@ -3,27 +3,36 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - inputs.sops-nix.url = "github:Mic92/sops-nix"; }; - outputs = { nixpkgs, ... }@inputs: - { - nixosConfigurations = { - default = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs;}; - system = "x86_64-linux"; - modules = [ - ./devices/xps13/configuration.nix - ./modules - ]; - }; - # pi = nixpkgs.lib.nixosSystem { - # specialArgs = {inherit inputs;}; - # system = "aarch64-linux"; - # modules = [ - # ./devices/pi/configuration.nix - # ]; - # }; - }; + outputs = {nixpkgs, ...} @ inputs: { + nixosConfigurations = { + default = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs;}; + system = "x86_64-linux"; + modules = [ + ./devices/xps13/configuration.nix + ./modules + ]; + }; + pi = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs;}; + system = "aarch64-linux"; + modules = [ + "${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64-installer.nix" + ./devices/pi/configuration.nix + { + sdImage.compressImage = false; + nixpkgs.overlays = [ + (final: super: { + makeModulesClosure = x: + super.makeModulesClosure (x // { allowMissing = true; }); + }) + ]; + } + ]; + }; }; + }; } +