Switch to flake-parts based flake
This commit is contained in:
parent
65d257d4ad
commit
b885d70549
78
flake.lock
78
flake.lock
|
@ -1,58 +1,78 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1710146030,
|
||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||
"lastModified": 1712014858,
|
||||
"narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "9126214d0a59633752a136528f5f3b9aa8565b7d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"haskell-flake": {
|
||||
"locked": {
|
||||
"lastModified": 1714268160,
|
||||
"narHash": "sha256-LNbwGgBT5EqfWN7pqYbj71VLLGQJqWkde3ToOhkM5vM=",
|
||||
"owner": "srid",
|
||||
"repo": "haskell-flake",
|
||||
"rev": "5b0857e0b7feec60bf00e075f7859746d52b8564",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "srid",
|
||||
"repo": "haskell-flake",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1713674382,
|
||||
"narHash": "sha256-1M/5T+D2obq8g5C3JZ2NnC4QGdbxcit5QkLd8ui3OYk=",
|
||||
"owner": "NixOS",
|
||||
"lastModified": 1714314149,
|
||||
"narHash": "sha256-yNAevSKF4krRWacmLUsLK7D7PlfuY3zF0lYnGYNi9vQ=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "44fa1ee8c2b0a581804e101c8627339c3fa2fd96",
|
||||
"rev": "cf8cc1201be8bc71b7cbbbdaf349b22f4f99c7ae",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"dir": "lib",
|
||||
"lastModified": 1711703276,
|
||||
"narHash": "sha256-iMUFArF0WCatKK6RzfUJknjem0H9m4KgorO/p3Dopkk=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d8fe5e6c92d0d190646fb9f1056741a229980089",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"dir": "lib",
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"flake-parts": "flake-parts",
|
||||
"haskell-flake": "haskell-flake",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"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",
|
||||
|
|
63
flake.nix
63
flake.nix
|
@ -1,52 +1,27 @@
|
|||
{
|
||||
description = "A snake game in Haskell using Dunai";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
haskell-flake.url = "github:srid/haskell-flake";
|
||||
};
|
||||
outputs = inputs@{ self, nixpkgs, flake-parts, ... }:
|
||||
flake-parts.lib.mkFlake { inherit inputs; } {
|
||||
imports = [ inputs.haskell-flake.flakeModule ];
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils, ... }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
|
||||
# package/executable name
|
||||
packageName = "snake";
|
||||
execName = packageName;
|
||||
|
||||
# version of ghc used
|
||||
hp = pkgs.haskell.packages.ghc92;
|
||||
|
||||
project = returnShellEnv:
|
||||
hp.developPackage {
|
||||
inherit returnShellEnv;
|
||||
name = packageName;
|
||||
root = ./.;
|
||||
withHoogle = false;
|
||||
modifier = drv:
|
||||
pkgs.haskell.lib.addBuildTools drv (with hp; [
|
||||
# Specify your build/dev dependencies here.
|
||||
hlint
|
||||
haskell-language-server
|
||||
ormolu
|
||||
systems = nixpkgs.lib.systems.flakeExposed;
|
||||
perSystem = { config, system, self', pkgs, ... }: {
|
||||
|
||||
pkgs.mesa
|
||||
pkgs.mesa_glu
|
||||
pkgs.freeglut
|
||||
]);
|
||||
};
|
||||
in
|
||||
{
|
||||
# Used by `nix build` & `nix run` (prod exe)
|
||||
packages.default = project false;
|
||||
|
||||
apps.default = {
|
||||
type = "app";
|
||||
program = "${self.packages.${system}.default}/bin/${execName}";
|
||||
_module.args.pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
config.allowBroken = true;
|
||||
};
|
||||
|
||||
# Used by `nix develop` (dev shell)
|
||||
devShell = project true;
|
||||
});
|
||||
haskellProjects.default = {
|
||||
basePackages = pkgs.haskell.packages.ghc94;
|
||||
};
|
||||
|
||||
packages.default = self'.packages.snake;
|
||||
apps.default = self'.apps.snake;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -9,6 +9,10 @@ build-type: Simple
|
|||
executable snake
|
||||
hs-source-dirs: src
|
||||
main-is: Main.hs
|
||||
other-modules: Game.Display,
|
||||
Game.Engine,
|
||||
Game.State,
|
||||
Game.Utils
|
||||
default-language: GHC2021
|
||||
default-extensions: Arrows
|
||||
build-depends: base,
|
||||
|
|
Loading…
Reference in a new issue