-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from lucernae/develop
Merge NixOS Flake Setup
Showing
11 changed files
with
465 additions
and
248 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,9 @@ etc-pihole | |
.env | ||
docker-compose.override.yml | ||
result | ||
sd-image.* | ||
output | ||
.direnv | ||
.DS_Store | ||
sd-image.* | ||
|
||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
{ config, pkgs, lib, ... }: | ||
{ | ||
# NixOS wants to enable GRUB by default | ||
boot.loader.grub.enable = false; | ||
# Enables the generation of /boot/extlinux/extlinux.conf | ||
boot.loader.generic-extlinux-compatible.enable = true; | ||
|
||
# !!! Set to specific linux kernel version | ||
boot.kernelPackages = pkgs.linuxPackages; | ||
|
||
# Disable ZFS on kernel 6 | ||
boot.supportedFilesystems = lib.mkForce [ | ||
"vfat" | ||
"xfs" | ||
"cifs" | ||
"ntfs" | ||
]; | ||
|
||
# !!! Needed for the virtual console to work on the RPi 3, as the default of 16M doesn't seem to be enough. | ||
# If X.org behaves weirdly (I only saw the cursor) then try increasing this to 256M. | ||
# On a Raspberry Pi 4 with 4 GB, you should either disable this parameter or increase to at least 64M if you want the USB ports to work. | ||
boot.kernelParams = [ "cma=256M" ]; | ||
|
||
# File systems configuration for using the installer's partition layout | ||
fileSystems = { | ||
# Prior to 19.09, the boot partition was hosted on the smaller first partition | ||
# Starting with 19.09, the /boot folder is on the main bigger partition. | ||
# The following is to be used only with older images. | ||
/* | ||
"/boot" = { | ||
device = "/dev/disk/by-label/NIXOS_BOOT"; | ||
fsType = "vfat"; | ||
}; | ||
*/ | ||
"/" = { | ||
device = "/dev/disk/by-label/NIXOS_SD"; | ||
fsType = "ext4"; | ||
}; | ||
}; | ||
|
||
# !!! Adding a swap file is optional, but strongly recommended! | ||
swapDevices = [{ device = "/swapfile"; size = 1024; }]; | ||
|
||
# Settings above are the bare minimum | ||
# All settings below are customized depending on your needs | ||
|
||
# systemPackages | ||
environment.systemPackages = with pkgs; [ | ||
vim | ||
curl | ||
wget | ||
nano | ||
bind | ||
kubectl | ||
kubernetes-helm | ||
iptables | ||
openvpn | ||
python3 | ||
nodejs | ||
docker-compose | ||
]; | ||
|
||
services.openssh = { | ||
enable = true; | ||
settings.PermitRootLogin = "yes"; | ||
}; | ||
|
||
programs.zsh = { | ||
enable = true; | ||
ohMyZsh = { | ||
enable = true; | ||
theme = "bira"; | ||
}; | ||
}; | ||
|
||
|
||
virtualisation.docker.enable = true; | ||
|
||
networking.firewall.enable = false; | ||
|
||
# WiFi | ||
hardware = { | ||
enableRedistributableFirmware = true; | ||
firmware = [ pkgs.wireless-regdb ]; | ||
}; | ||
|
||
# put your own configuration here, for example ssh keys: | ||
users.defaultUserShell = pkgs.zsh; | ||
users.mutableUsers = true; | ||
users.groups = { | ||
nixos = { | ||
gid = 1000; | ||
name = "nixos"; | ||
}; | ||
}; | ||
users.users = { | ||
nixos = { | ||
uid = 1000; | ||
home = "/home/nixos"; | ||
name = "nixos"; | ||
group = "nixos"; | ||
shell = pkgs.zsh; | ||
extraGroups = [ "wheel" "docker" ]; | ||
}; | ||
}; | ||
users.users.root.openssh.authorizedKeys.keys = [ | ||
# Your ssh key | ||
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDqlXJv/noNPmZMIfjJguRX3O+Z39xeoKhjoIBEyfeqgKGh9JOv7IDBWlNnd3rHVnVPzB9emiiEoAJpkJUnWNBidL6vPYn13r6Zrt/2WLT6TiUFU026ANdqMjIMEZrmlTsfzFT+OzpBqtByYOGGe19qD3x/29nbszPODVF2giwbZNIMo2x7Ww96U4agb2aSAwo/oQa4jQsnOpYRMyJQqCUhvX8LzvE9vFquLlrSyd8khUsEVV/CytmdKwUUSqmlo/Mn7ge/S12rqMwmLvWFMd08Rg9NHvRCeOjgKB4EI6bVwF8D6tNFnbsGVzTHl7Cosnn75U11CXfQ6+8MPq3cekYr lucernae@lombardia-N43SM" | ||
]; | ||
system.stateVersion = "23.05"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{ | ||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
flake-compat = { | ||
url = "github:edolstra/flake-compat"; | ||
flake = false; | ||
}; | ||
devshell.url = "github:numtide/devshell"; | ||
}; | ||
|
||
outputs = { self, nixpkgs, flake-utils, devshell, ... }: | ||
flake-utils.lib.eachDefaultSystem (system: { | ||
apps.devshell = self.outputs.devShell.${system}.flakeApp; | ||
formatter = nixpkgs.legacyPackages.${system}.nixpkgs-fmt; | ||
packages = { | ||
nixosConfigurations = | ||
let | ||
inherit (nixpkgs.lib) nixosSystem; | ||
in | ||
rec { | ||
# to build: nix build github:lucernae/nix-config#nixosConfigurations.raspberry-pi_3.config.system.build.sdImage | ||
raspberry-pi_3 = nixosSystem { | ||
system = "aarch64-linux"; | ||
modules = [ | ||
"${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64-installer.nix" | ||
# replace this with your target configuration | ||
./configuration.nix | ||
|
||
# extra config for sdImage generator | ||
{ | ||
sdImage.compressImage = false; | ||
} | ||
]; | ||
}; | ||
raspberry-pi_3_default = nixosSystem { | ||
system = "aarch64-linux"; | ||
modules = [ | ||
"${nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64-installer.nix" | ||
# replace this with your target configuration | ||
./configuration.default.nix | ||
|
||
# extra config for sdImage generator | ||
{ | ||
sdImage.compressImage = false; | ||
} | ||
]; | ||
}; | ||
}; | ||
}; | ||
devShell = | ||
let | ||
pkgs = import nixpkgs { | ||
inherit system; | ||
overlays = [ devshell.overlays.default ]; | ||
}; | ||
in | ||
pkgs.devshell.mkShell { | ||
name = "nixos-pi"; | ||
commands = [ | ||
]; | ||
packages = with pkgs; [ | ||
git | ||
qemu | ||
qemu_kvm | ||
]; | ||
}; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,10 @@ | ||
let _pkgs = import <nixpkgs> { }; | ||
in { pkgs ? import (_pkgs.fetchFromGitHub { | ||
owner = "NixOS"; | ||
repo = "nixpkgs-channels"; | ||
#branch@date: nixpkgs-unstable@2021-01-25 | ||
rev = "502845c3e31ef3de0e424f3fcb09217df2ce6df6"; | ||
sha256 = "0fcqpsy6y7dgn0y0wgpa56gsg0b0p8avlpjrd79fp4mp9bl18nda"; | ||
}) { } }: | ||
|
||
with pkgs; | ||
|
||
mkShell { | ||
buildInputs = [ | ||
git | ||
qemu | ||
qemu_kvm | ||
]; | ||
} | ||
(import | ||
( | ||
let lock = builtins.fromJSON (builtins.readFile ./flake.lock); in | ||
fetchTarball { | ||
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; | ||
sha256 = lock.nodes.flake-compat.locked.narHash; | ||
} | ||
) | ||
{ src = ./.; } | ||
).shellNix |