1
1
Files
deployed-nixos-server-and-apps/flake.nix
Bill Ewanick 63224ce917
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
Gitea Actions Demo / build-site (push) Successful in 3s
Downgrade to 25.11, more stable for server
2026-01-03 23:09:00 -05:00

151 lines
4.0 KiB
Nix

{
description = "Flake.parts System flake for Linode NixOS server";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
flake-parts.url = "github:hercules-ci/flake-parts";
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 @ {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
];
};
};
};
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.
# Equivalent to inputs'.nixpkgs.legacyPackages.hello;
# packages.default = pkgs.hello;
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;
};
};
};
};
}