nix: init flake

Co-authored-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
This commit is contained in:
Malte Poll 2023-09-04 18:45:13 +02:00 committed by Malte Poll
parent ac2fca344d
commit b25ae9a3be
4 changed files with 136 additions and 14 deletions

78
flake.lock Normal file
View File

@ -0,0 +1,78 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgsUnstable": {
"locked": {
"lastModified": 1695318763,
"narHash": "sha256-FHVPDRP2AfvsxAdc+AsgFJevMz5VBmnZglFUMlxBkcY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e12483116b3b51a185a33a272bf351e357ba9a99",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgsWorking": {
"locked": {
"lastModified": 1695660025,
"narHash": "sha256-9kCTqG3Coaq5qZMLRRYUVVAVzRrYP6+CPi3WMqGbdKY=",
"owner": "katexochen",
"repo": "nixpkgs",
"rev": "53e5fdfd2399716305b21ee1535590527f7f6e6a",
"type": "github"
},
"original": {
"owner": "katexochen",
"ref": "working",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgsUnstable": "nixpkgsUnstable",
"nixpkgsWorking": "nixpkgsWorking"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

51
flake.nix Normal file
View File

@ -0,0 +1,51 @@
{
description = "Constellation";
inputs = {
nixpkgsWorking = {
url = "github:katexochen/nixpkgs/working";
};
nixpkgsUnstable = {
url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};
flake-utils = {
url = "github:numtide/flake-utils";
};
};
outputs =
{ self
, nixpkgsWorking
, nixpkgsUnstable
, flake-utils
}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgsWorking = import nixpkgsWorking { inherit system; };
pkgsUnstable = import nixpkgsUnstable { inherit system; };
mkosiDev = (pkgsWorking.mkosi.overrideAttrs (oldAttrs: rec {
propagatedBuildInputs = oldAttrs.propagatedBuildInputs ++ (with pkgsWorking; [
# package management
dnf5
rpm
# filesystem tools
squashfsTools # mksquashfs
dosfstools # mkfs.vfat
mtools # mcopy
cryptsetup # dm-verity
util-linux # flock
kmod # depmod
]);
}));
in
{
packages.mkosi = mkosiDev;
devShells.default = import ./nix/shells/default.nix { pkgs = pkgsUnstable; };
formatter = nixpkgsUnstable.legacyPackages.${system}.nixpkgs-fmt;
});
}

7
nix/shells/default.nix Normal file
View File

@ -0,0 +1,7 @@
{ pkgs, ... }:
pkgs.mkShell {
nativeBuildInputs = with pkgs; [
bazel_6
git
];
}

View File

@ -1,14 +0,0 @@
{pkgs ? import <nixpkgs> {}}:
(pkgs.buildFHSUserEnv {
name = "bazel";
targetPkgs = pkgs: [
pkgs.git
pkgs.go
pkgs.bazel_6
pkgs.glibc
pkgs.gcc
pkgs.jdk11 # TODO(katexochen): investigate why our build chain doesn't work on NixOS
pkgs.libxcrypt-legacy # TODO(malt3): python toolchain depends on this. Remove once https://github.com/bazelbuild/rules_python/issues/1211 is resolved
];
})
.env