1
1

Switch to flake.parts

This commit is contained in:
2026-01-03 20:46:01 -05:00
parent 9d24e57147
commit 951ef7f777
2 changed files with 166 additions and 646 deletions

170
flake.nix
View File

@@ -1,46 +1,150 @@
{
description = "System flake for Linode NixOS server";
# Want to convert this to Flake Parts flake so I can use their special features
nixConfig = {
extra-substituters = "https://srid.cachix.org";
extra-trusted-public-keys = "srid.cachix.org-1:3clnql5gjbJNEvhA/WQp7nrZlBptwpXnUk6JAv8aB2M=";
};
description = "Flake.parts System flake for Linode NixOS server";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
emanote.url = "github:srid/emanote";
emanote.inputs.emanote-template.follows = "";
flake-parts.follows = "emanote/flake-parts";
# nixpkgs.follows = "emanote/nixpkgs";
osds-site.url = "git+https://git.ewanick.com/bill/osds-site";
git-hooks-nix.url = "github:cachix/git-hooks.nix";
git-hooks-nix.inputs.nixpkgs.follows = "nixpkgs";
treefmt-nix.url = "github:numtide/treefmt-nix";
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
inputs@{
self,
nixpkgs,
emanote,
osds-site,
...
}:
{
nixosConfigurations.linode-nixos = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs emanote; };
modules = [
{
nixpkgs.config.permittedInsecurePackages = [
"jitsi-meet-1.0.8792"
outputs = inputs @ {flake-parts, ...}:
flake-parts.lib.mkFlake {inherit inputs;} {
imports = [
# To import a flake module
# 1. Add foo to inputs
# 2. Add foo as a parameter to the outputs function
# 3. Add here: foo.flakeModule
inputs.git-hooks-nix.flakeModule
inputs.treefmt-nix.flakeModule
];
systems = [
"x86_64-linux"
# "aarch64-linux"
# "aarch64-darwin"
# "x86_64-darwin"
];
flake = {
# The usual flake attributes can be defined here, including system-
# agnostic ones like nixosModule and system-enumerating ones, although
# those are more easily expressed in perSystem.
nixosConfigurations = {
linode-nixos = inputs.nixpkgs.lib.nixosSystem {
# system is not needed with freshly generated hardware-configuration.nix
# system = "x86_64-linux"; # or set nixpkgs.hostPlatform in a module.
specialArgs = {inherit inputs;};
modules = [
{
nixpkgs.config.permittedInsecurePackages = [
"jitsi-meet-1.0.8792"
];
}
./server-config/configuration.nix
./nixos-apps
];
}
};
};
};
./server-config/configuration.nix
perSystem = {
config,
self',
inputs',
pkgs,
system,
...
}: {
# Per-system attributes can be defined here. The self' and inputs'
# module parameters provide easy access to attributes of the same
# system.
./nixos-apps
# Equivalent to inputs'.nixpkgs.legacyPackages.hello;
# packages.default = pkgs.hello;
# osds-site
];
devShells.default = let
# https://downloads.haskell.org/~ghc/9.10.3/docs/users_guide/index.html
ghc' = pkgs.haskell.packages.ghc9103.ghcWithHoogle (
self:
with self; [
relude
split
aeson
random
neat-interpolation
# maths
primes
arithmoi
parallel
# graphing libraries!
Chart
Chart-cairo
]
);
clean = pkgs.writeShellScriptBin "clean" ''
# Delete executables
find . -type f -executable -not -path '*/.git/*' -delete
# Delete all Haskell IR files
find . -type f -name '*.hi' -delete
find . -type f -name '*.o' -delete
# Delete any test graphs created
find . -type f -name '*.png' -delete
'';
in
pkgs.mkShell {
packages = with pkgs; [
cowsay
alejandra
ghc'
clean
haskell-language-server
ghcid
hlint
kotlin
];
shellHook = ''
${config.pre-commit.installationScript}
echo Hello alice
'';
};
pre-commit = {
settings.hooks = {
alejandra.enable = true;
mdformat.enable = true;
prettier.enable = true;
prettier.excludes = [".*\.md" "flake.lock"];
stylish-haskell.enable = true;
};
};
treefmt = {
programs = {
alejandra.enable = true;
mdformat.enable = true;
prettier.enable = true;
prettier.excludes = ["*.md"];
stylish-haskell.enable = true;
};
};
};
};
}