improved organisation

moved host modules to hosts/modules and modified deploy script
This commit is contained in:
Emile Clark-Boman 2025-02-24 13:19:36 +10:00
parent 9636eab7f6
commit c3b02c5f7b
18 changed files with 27 additions and 20 deletions

20
hosts/modules/colmena.nix Normal file
View file

@ -0,0 +1,20 @@
{}: {
# Colmena's latest stable version is
# unusable so get latest unstable version.
colmena = let
src = pkgsBuild.fetchFromGitHub {
owner = "zhaofengli";
repo = "colmena";
rev = "47b6414d800c8471e98ca072bc0835345741a56a";
sha256 = "rINodqeUuezuCWOnpJgrH7u9vJ86fYT+Dj8Mu8T/IBc=";
};
flake =
pkgsBuild.callPackage "${src}/flake.nix" {
};
in
flake.packages."${system}".colmena;
nixpkgs.config.packageOverrides = pkgs: {
colmena = pkgs.callPackage
};
}

View file

@ -0,0 +1,12 @@
{ pkgs, ... }:
{
# Enable Bluetooth
hardware.bluetooth.enable = true;
hardware.bluetooth.powerOnBoot = false;
# TODO: this should be managed by home-manager
environment.systemPackages = with pkgs; [
overskride
];
}

View file

@ -0,0 +1,15 @@
{...}:
{
boot.loader = {
efi = {
canTouchEfiVariables = true;
efiSysMountPoint = "/boot/efi";
};
grub = {
efiSupport = true;
#efiInstallAsRemovable = true; # in case canTouchEfiVariables doesn't work on your system
device = "nodev";
};
};
}

View file

@ -0,0 +1,8 @@
{...}:
{
boot.loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
}

View file

@ -0,0 +1,16 @@
{ ... }:
{
# Optimize storage and automatic scheduled GC running
# If you want to run GC manually, use commands:
# `nix-store --optimize` for finding and eliminating redundant copies of identical store paths
# `nix-store --gc` for optimizing the nix store and removing unreferenced and obsolete store paths
# `nix-collect-garbage -d` for deleting old generations of user profiles
nix.settings.auto-optimise-store = true;
nix.optimise.automatic = true;
nix.gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 14d";
};
}

View file

View file

@ -0,0 +1,29 @@
# Credit: https://github.com/XNM1/linux-nixos-hyprland-config-dotfiles/
{ pkgs, ... }:
{
# Enable sound with pipewire.
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
wireplumber.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
# media-session.enable = true;
};
# TODO: these should instead be manager but home-manager
environment.systemPackages = with pkgs; [
helvum
easyeffects
];
}

View file

@ -0,0 +1,29 @@
{
lib,
pkgs,
config,
inputs,
outputs,
...
}:
{
imports = [
config.nixcord.homeManagerModules.nixcord
];
programs.nixcord = {
enable = true;
config = {
#themeLinks = [
# ""
#];
# no surrounding window frame
frameless = true;
plugins = {
};
};
};
}

View file

@ -0,0 +1,31 @@
#### wishlist.nix
This is a simple Nix flake defining a service from which
wishlist can run automatically. This flake runs wishlist-0.15.1
and lacks configurability unfortunately. However this was an
intentional choice, allowing wishlist to read from the user's
`~/.ssh/config` file, which can be configured seperately using
the something akin to the follow home-manager snippet:
```nix
programs.ssh = {
enable = true;
addKeysToAgent = "yes"; # always add keys to ssh-agent
matchBlocks = {
hyrule = {
hostname = "imbored.dev";
user = "ae";
port = 22;
identityFile = "/home/me/.ssh/id_hyrule";
};
};
};
```
This decision was mostly selfish as it was easiest...
But it comes at the cost of not being able to set the
port wishlist listens on. So for now you're stuck with `2222`.
###### The Future!! (woooowwww)
Create an option for wishlist that is used to construct
the `config.yaml` file

View file

@ -0,0 +1,93 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
self,
config,
nixpkgs,
lib,
flake-utils,
}: let
cfg = config.services.wishlist;
supportedSystems = ["x86_64-linux" "i686-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
in {
# TODO: 1. add options (ie one to set whether the server should be enabled),
# 2. create a systemd service
# 3. create a main program
# 4. celibrate
# TODO: do I need to make this a home-manager option and set the yaml config?
# define what settings a user can change
options = {
services.wishlist = with lib; {
enable = mkEnableOption "wishlist";
port = mkOption {
type = types.port;
default = 2222;
description = "Port to listen on";
};
package = mkOption {
type = types.package;
default = self.packages.${nixpkgs.system}.default;
description = "Package to use";
};
};
};
# define a systemd service for wishlist ^_^
config = lib.mkIf cfg.enable {
systemd.services.wishlist = {
description = "Single entrypoint for multiple SSH endpoints";
wantedBy = ["multi-user.target"];
serviceConfig = {
DynamicUser = "yes";
ExecStart = "${cfg.package}/bin/wishlist serve";
Restart = "always";
RestartSec = "2s";
};
};
};
packages = flake-utils.lib.eachSystem supportedSystems (
system: let
version = "0.15.1";
#pkgs = nixpkgs.legacyPackages.${system};
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = false;
};
#lib = pkgs.lib;
in rec {
defaultPackage = self.packages.${system}.wishlist;
wishlist = pkgs.buildGoModule {
pname = "wishlist";
inherit version;
meta = with lib; {
description = "Single entrypoint for multiple SSH endpoints";
homepage = "https://github.com/charmbracelet/wishlist";
changelog = "https://github.com/charmbracelet/wishlist/releases/tag/v${version}";
license = licenses.mit;
maintainers = with maintainers; [caarlos0 penguwin];
mainProgram = "wishlist";
};
src = pkgs.fetchFromGitHub {
owner = "charmbracelet";
repo = "wishlist";
rev = "v${version}";
# rev = "d7f058e115a8b4a4131406d01dde84fb4a8e93c4";
hash = "53fojA+gdvpSVNjx6QncH16F8/x+lpY5SkNs7obW2XQ=";
};
vendorSha256 = "0x6rss3fwv2398wrd5kyzkrqaphzvh4ykwfqai9glxm01y6fhxz7";
};
}
);
};
}

View file

@ -0,0 +1,99 @@
# NOTE: Wishlist service fails on nix because of readonly file system
# and it can't find a config file for itself, it needs to write that
# itself I suppose :(
# So:
# 1. Get it to write that file, and
# 2. Allow it to inherit profiles from configured ssh
{
self,
config,
pkgs,
lib,
}: let
cfg = config.services.wishlist;
in {
options = {
services.wishlist = with lib; {
enable = mkEnableOption "wishlist";
name = mkOption {
type = types.str;
default =
};
port = mkOption {
type = types.port;
default = 2222;
description = "Port to listen on";
};
#configPath = mkOption {
# type = types.path;
# default = ;
# description = "Path to config file";
#};
package = mkOption {
type = types.package;
default = self.packages.${nixpkgs.system}.default;
description = "Package to use";
};
};
};
# define a systemd service for wishlist ^_^
config = lib.mkIf cfg.enable {
systemd.services.wishlist = {
description = "Single entrypoint for multiple SSH endpoints";
wantedBy = ["multi-user.target"];
serviceConfig = let
wishlistServiceConfig = pkgs.writeText "config.yaml" ''
hello world!
'';
in {
DynamicUser = "yes";
ExecStart = "${pkgs.wishlist}/bin/wishlist serve --config ${wishlistServiceConfig}";
Restart = "always";
RestartSec = "2s";
};
};
};
/*
packages = flake-utils.lib.eachSystem supportedSystems (
system: let
version = "0.15.1";
#pkgs = nixpkgs.legacyPackages.${system};
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = false;
};
#lib = pkgs.lib;
in rec {
defaultPackage = self.packages.${system}.wishlist;
wishlist = pkgs.buildGoModule {
pname = "wishlist";
inherit version;
meta = with lib; {
description = "Single entrypoint for multiple SSH endpoints";
homepage = "https://github.com/charmbracelet/wishlist";
changelog = "https://github.com/charmbracelet/wishlist/releases/tag/v${version}";
license = licenses.mit;
maintainers = with maintainers; [caarlos0 penguwin];
mainProgram = "wishlist";
};
src = pkgs.fetchFromGitHub {
owner = "charmbracelet";
repo = "wishlist";
rev = "v${version}";
# rev = "d7f058e115a8b4a4131406d01dde84fb4a8e93c4";
hash = "53fojA+gdvpSVNjx6QncH16F8/x+lpY5SkNs7obW2XQ=";
};
vendorSha256 = "0x6rss3fwv2398wrd5kyzkrqaphzvh4ykwfqai9glxm01y6fhxz7";
};
}
);
*/
}

View file

@ -0,0 +1,30 @@
# NOTE: hyprland must be enabled in BOTH your host config (for running hyprland)
# and your home-manager config (for managing hyprland's config files)
{
pkgs,
inputs,
config,
lib,
...
}: {
options.hyprland = {
enable = lib.mkEnableOption "Hyprland";
};
config = lib.mkIf config.hyprland.enable {
programs.hyprland = {
enable = true;
#package = inputs.hyprland.packages.${pkgs.system}.hyprland;
xwayland.enable = true;
};
xdg.portal = {
enable = true;
extraPortals = with pkgs; [
xdg-desktop-portal-gtk
];
};
# TODO: finish this (I didn't like the dotfiles I was getting inspo from and stopped)
};
}

View file

@ -0,0 +1,72 @@
{
description = "Wishlist: Your SSH directory."
inputs = {
};
outputs = {
self
}: let
nixosModule = {
config,
lib,
pkgs,
...
}: {
options.services.wishlist = {
enable = lib.mkEnableOption "Your SSH directory.";
port = lib.mkOption {
type = lib.types.port;
default = 22;
description = "Port to listen on";
};
};
config = lib.mkIf config.services.wishlist.enable {
# configure the systemd service
systemd.services.wishlist = {
description = "Your SSH directory.";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
ExecStart = "${self.packages.${pkgs.system}.default}/bin/wishlist";
Restart = "always";
Type = "simple";
DynamicUser = "yes";
};
# environment variables
environment = {
};
};
};
};
in
(flake-utils.lib.eachDefaultSystem (system: let
gopkg = go-nixpkgs.legacyPackages.${system};
in {
packages.default = gopkg.buildGoModule ############################
}))
buildGoModule rec { # is rec necessary?
pname = "wishlist";
version = "0.15.1"
src = fetchFromGithub {
owner = "charmbracelet";
repo = "wishlist";
rev = "v${version}";
hash = "0c9g1s8j9znzd1mw61d0klc6sqri0wx6hljibxdwzi3cabfy3ld6";
};
vendorSha256 = lib.fakeSha256;
meta = with lib; {
homepage = "https://github.com/charmbracelet/wishlist";
description = "Your SSH directory.";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ caarlos0 ];
};
};
}

View file

@ -0,0 +1,22 @@
{lib}: {
buildGoModule rec { # is rec necessary?
pname = "wishlist";
version = "0.15.1"
src = fetchFromGithub {
owner = "charmbracelet";
repo = "wishlist";
rev = "v${version}";
hash = "0c9g1s8j9znzd1mw61d0klc6sqri0wx6hljibxdwzi3cabfy3ld6";
};
vendorSha256 = lib.fakeSha256;
meta = with lib; {
homepage = "https://github.com/charmbracelet/wishlist";
description = "Your SSH directory.";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ caarlos0 ];
};
};
}