Signed-off-by: Xe <me@christine.website>
This commit is contained in:
Cadey Ratio 2021-12-26 11:53:12 -05:00
parent a5daa4c297
commit 295a90fb41
2 changed files with 56 additions and 7 deletions

View File

@ -65,7 +65,24 @@
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flake-utils": "flake-utils",
"naersk": "naersk", "naersk": "naersk",
"nixpkgs": "nixpkgs_2" "nixpkgs": "nixpkgs_2",
"xess": "xess"
}
},
"xess": {
"flake": false,
"locked": {
"lastModified": 1637634344,
"narHash": "sha256-63zWhmRpppLzh+H70gHSViHfZ4JvtnOFDRrrjkXtzJE=",
"owner": "Xe",
"repo": "Xess",
"rev": "f9ffc529fca9751afdce2408089c51e73d56fce8",
"type": "github"
},
"original": {
"owner": "Xe",
"repo": "Xess",
"type": "github"
} }
} }
}, },

View File

@ -2,18 +2,41 @@
inputs = { inputs = {
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
naersk.url = "github:nix-community/naersk"; naersk.url = "github:nix-community/naersk";
xess = {
url = "github:Xe/Xess";
flake = false;
};
}; };
outputs = { self, nixpkgs, flake-utils, naersk }: outputs = { self, nixpkgs, flake-utils, naersk, xess }:
flake-utils.lib.eachDefaultSystem (system: flake-utils.lib.eachDefaultSystem (system:
let let
pkgs = nixpkgs.legacyPackages."${system}"; pkgs = nixpkgs.legacyPackages."${system}";
naersk-lib = naersk.lib."${system}"; naersk-lib = naersk.lib."${system}";
srcNoTarget = dir:
builtins.filterSource (path: type:
type != "directory" || builtins.baseNameOf path != "target") dir;
src = srcNoTarget ./.;
in rec { in rec {
# `nix build` # `nix build`
packages.printerfacts = naersk-lib.buildPackage { packages = rec {
printerfacts-bin = naersk-lib.buildPackage {
pname = "printerfacts"; pname = "printerfacts";
root = ./.; root = srcNoTarget ./.;
};
printerfacts = pkgs.stdenv.mkDerivation {
inherit (printerfacts-bin) name;
inherit src;
phases = "installPhase";
installPhase = ''
mkdir -p $out/static
cp -rf $src/templates $out/templates
cp -rf ${printerfacts-bin}/bin $out/bin
cp -rf ${xess}/static/css/xess.css $out/static/gruvbox.css
'';
};
}; };
defaultPackage = packages.printerfacts; defaultPackage = packages.printerfacts;
@ -23,8 +46,17 @@
defaultApp = apps.printerfacts; defaultApp = apps.printerfacts;
# `nix develop` # `nix develop`
devShell = devShell = pkgs.mkShell {
pkgs.mkShell { nativeBuildInputs = with pkgs; [ rustc cargo ]; }; nativeBuildInputs = with pkgs; [
rustc
cargo
cargo-watch
rls
rustfmt
];
RUST_LOG = "info";
};
nixosModules.printerfacts = { config, lib, pkgs, ... }: nixosModules.printerfacts = { config, lib, pkgs, ... }:
with lib; with lib;